![]() |
|
|
#1
|
|||
|
|||
|
I have many sub directories on one drive (say H); I have large # of pictures (all are jpeg) in them. I want to move all the pictures into one directory (say I:\pictures). So after the move, I will have all the pictures in I:\pictures (without any sub directories).
Any recursive script to do it? Did a web search, found a way to move the whole directory tree; that is not what I want. |
|
#2
|
||||
|
||||
|
Wouldn't you need the complete list of subfolder names? I would do
This is a sledgehammer method: dir /a:d > subfolders.txt then use notepad to trim down the list of subfolders to you will get: h:\january h:\february h:\march etc. When you got the list, copy "copy " before each line, and "*.* i:\images\" after each line. Then save the file as imagemove.bat and run it from a command line. |
|
#3
|
||||
|
||||
|
Not sure how to do it directly. But here is how I'd do it.
Step 1) from the H: drive root> dir *.jpg /s /b > AllMyPr0n.txt Step 2) open the file in your favorite text editor (or excel) Step 3) insert "copy " before the filename and " I:\pictures\" after the filename (like below) Code:
copy "h:\some\really\long\path\tda avatar.jpg" i:\pictures\ Step 5) run CopyAllMyPr0n.bat Step 6) ??? Step 7) Profit If there is too many pictures to do this method with, you might be able to dir * /s /b /ad > MyPr0nDirectories.txt (this will create a listing of just the directories) edit the text file so that a sample line looks like copy "h:\some\really\long\path\*.jpg" i:\pictures\
__________________
Some people are like clouds. When they disappear, it's a brighter day. Last edited by GadgetGeek; 03-15-2010 at 04:32 PM.. Reason: Ninja'd |
|
#4
|
||||
|
||||
|
Unless something has been added since MSDOS 5.0, I don't believe that there is a single command that will do this.
Having said that, if this is a on time deal you can create a batch file to do this for you. First, you'll need a list of files to be copied. Code:
dir /b /s > \temp.csv Code:
copy <path><filename> I:\pictures\<filename> Code:
\temp del \temp.csv del \temp.bat Code:
del <path>\*.* /s |
|
#5
|
|||
|
|||
|
As another alternative, you can use Windows Search on your parent directory to look for *.jpeg, then cut/paste all files in the search results to the new location.
far_side |
|
#6
|
|||
|
|||
|
Thanks all.
|
|
#7
|
||||
|
||||
|
All you need is a recursive FOR loop:
for /r H:\toplevel %j IN (*.jpg) do copy %j I:\pictures where "toplevel" is the name of the parent directory that holds all the subdirectories you're interested in. Use the root H:\ if there is no such parent directory that holds everything you want.
__________________
There has grown up in the minds of certain groups in this country the notion that because a man or corporation has made a profit out of the public for a number of years, the government and the courts are charged with the duty of guaranteeing such profit in the future, even in the face of changing circumstances and contrary to public interest. This strange doctrine is not supported by statute or common law. Neither individuals nor corporations have any right to come into court and ask that the clock of history be stopped, or turned back. - Life-Line, Robert A. Heinlein, 1939 |
|
#8
|
|||
|
|||
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|