any way to automate the process of creating folders and moving a large number of files

brannsiu

Distinguished
Apr 20, 2013
146
1
18,635
I have a windows folder that contains up to tens of thousands of files that I want to sort them into sub-folders. Luckily their naming structure is something like

germany_001.jpg, germany_002.jpg, germany_003.jpg ....germany_1000.jpg,etc
and italy_001.jpg, italy_002.jpg...italy_999.jpg

...many many other files starting with different names, in addition to germany and italy


is there any way to automate the process of creating each folder for Germany , and italy and ... many other files and moving the files to corresponding folders?

e.g. automatically creating a large number of folders with name like germany , italy, india ..........

e.g. then all files starting with germany_ being moved to germany folder
all files starting with italy_ being moved to italy folder..

 
Solution
Take a look at Powershell.

Here are a couple of links that generally address your requirements:

http://stackoverflow.com/questions/39944685/order-and-move-files-into-directories-based-on-some-filenames-pattern

https://gist.github.com/devavret/1ea5b32cdc759244125a2ccbd6e472d7

There are other links. Google "move files by filename powershell" or some such words and phrases.

You can cut and paste the script and then edit it to do exactly as you need.

Series of steps: finding/identifying the files for each folder, testing for and creating a folder if necessary, move the files.

Hefty project but if you are doing IT Admin stuff, Powershell is probably something you should know or learn.

boju

Distinguished
Not sure of a program but do you know about shift copy (as an alternative) to select the list you want?


Click the column description of how you want the folder to be sorted. ie; Name, Date modified, Type. When you have the files arranged, click the first file to highlight of the set you want then use the slider bar to go down to the last file. Hold shift before clicking the last file. Ctrl x to cut or right click mouse to move to folder.

If you have a very long list can hold ctrl to lock the selected file so if you click off the slider by accident you wont lose the highlight.
 

skittle

Distinguished
Dec 27, 2006
99
0
18,610
yes you can do this with windows batch file. or just use windows explorer search feature with wildcards

make a directory called germany
search for "germany*.jpg"
select all, then move to the folder.
repeat for other category
 

brannsiu

Distinguished
Apr 20, 2013
146
1
18,635


I totally know this method,

but I don't even want to create directory manually, I want to automate the process, because I could need
to create 1000 or 1,000 directory and there are 10,000 or 100,000 files

thanks

y
 
It would be easier from the command line. Open Windows Explorer at the folder above the images' folder, then hold down <Shift> and right-click on the folder with images. Choose "Open command prompt here".
Now, at the command prompt, it is simply
Code:
C:\Users\XXX\Photos\>mkdir Germany
C:\Users\XXX\Photos\>move Germany*.jpg Germany
 
Take a look at Powershell.

Here are a couple of links that generally address your requirements:

http://stackoverflow.com/questions/39944685/order-and-move-files-into-directories-based-on-some-filenames-pattern

https://gist.github.com/devavret/1ea5b32cdc759244125a2ccbd6e472d7

There are other links. Google "move files by filename powershell" or some such words and phrases.

You can cut and paste the script and then edit it to do exactly as you need.

Series of steps: finding/identifying the files for each folder, testing for and creating a folder if necessary, move the files.

Hefty project but if you are doing IT Admin stuff, Powershell is probably something you should know or learn.

 
Solution