3

I have a task to split a single file into two separate files which I have done. However, afterward I need to move the source file from the source directory into an Archive folder so it does not get picked up again the next day.

The file name is quite bad, something like "DFG.AE234125.HDS932.H001.U001", but is out of my control to rename as we receive the file like that from external. My loop works fine in the sense that it picks up all files and splits them as it should by iterating using a User::SelectedFile variable. When it reaches the newly added "move file to archive" script task it gets stuck in loading for almost a full minute and returns error like "Filename cannot contain character like '/\=,.'" Script is in C# and it declaring two strings one for the archive path and the other for the file name and uses the User::SelectedFile variable.

Things I have considered/tried:

  1. Checking the file paths (they are correct as I am using a test directory on my C Drive as I do not have access to the server location)
  2. As I am using local location it can't be a permission problem especially as it is picking up the file for the split.
  3. This is a standalone process that uses flat file connections, so there is not server connection issue.
  4. I have also tried using File System Task for this but get the same error for the name.
  5. The C# script itself is copy&pasted from another package that needs to move the processed file to an archive folder. It works there. All I have done in the new script is changing the variables for the path.
  6. I have added breakpoints and can see that the variables have the correct values when they reach the script task.

The issue seems to be at the point where the process lands at the script task. At this point the split has already been done successfully. Can someone advise on a workaround to ignore the "."s in the filename so I can move the damn thing to the archive folder?

This is my first post on Stackoverflow so any feedback on the post itself is welcome.

Many thanks in advance.

IP

  • Dots are valid in filenames. However, slashes need to be escaped with a another slash. Can you show us your folder path variable? Have you tried doubling up the slashes? myStrng = "\\\\SERVER\\Path\\To\\MyFolder" – Troy Witthoeft Oct 25 '16 at 12:17
  • Thank you for your reply Troy. Yes my string has double backward slashes. I worked around the issue by simply moving all files form the source directory to processed using a powershell script which does not care about the dots. I set it to run outside the loop so it will move the files once all are processed. This seems to do what I want it to do but I am annoyed that I spent a day on something like this. I would rather it move the file after process in case of failure on one file. – thinkcoding Oct 25 '16 at 13:41
  • Anyway I will mark this as resolved. If anyone is interested in the future this was the error I was getting "The object name "@[User::SelectedFile]" is not valid. The name cannot contain any of the following characters: / \ : [ ] . =". – thinkcoding Oct 25 '16 at 13:41
  • Mark this as answered. – Jason Byrd Sep 10 '17 at 03:39

0 Answers0