r/programmingrequests • • Apr 04 '17

[X-Post r/learnprogramming] Automate file transfer task in windows, search, move and create new folder

Hi, apologies in advance if this question does not meet the subs criteria, but I will throw it out there anyway. Background, I have no experience at all in programming, but I have a bunch (2000 +) files that need to be organised according to specific parameters. There must be an easier way than doing each one manually. If someone could shed some light on the easiest / quickest way to go about it, would be most appreciative. This is the scenario I want to happen.

*Perform a search in a specified directory (let say c:\files)
*Search sequentially from S0 -> S01 -> S001 ->...->S00001.
*When search returns result (e.g S23) then move files to "designated directory\search term". ( lets say c:\file transfer\S23 )
*If no sub directory exists, a new directory should be created.
*If no search result returned move to next search term ( S24 )
*Repeat until all files have been moved.

Is there a simple way to put this into practice?

2 Upvotes

3 comments sorted by

View all comments

2

u/SamSlate Apr 05 '17

Very doable. Is there anything this program does beyond removing zeros from directory names?

C:/file/s01 -> c:/new location/s1

Yes? The entire directory?

1

u/I_shot_barney Apr 05 '17

Sorry, I badly explained. I want the program to search through file names and any files that return a value in the range S1 through to S9999 are to be moved to a separate sub directory with the name of the sub directory to be the return search value.

So, if a have a list of files and one of the file names is
"Data S3459 current.pdf"
Then move to folder c:..\S3459
If no folder exists then create new folder.

Very confusing because here I am using S as a string not a placeholder ( I think those are the terms )

I appreciate your response. From looking around it might be best accomplished with a .bat file. This is just a little side product, just out of interest if I can do it.