Actuarial Outpost
 
Go Back   Actuarial Outpost > Actuarial Discussion Forum > Software & Technology
FlashChat Actuarial Discussion Preliminary Exams CAS/SOA Exams Cyberchat Around the World Suggestions

US LIFE, ANNUITY AND INVESTMENT JOBS

Reply
 
Thread Tools Display Modes
  #1  
Old 03-15-2010, 04:09 PM
no
Guest
 
Posts: n/a
Default MS-DOS question for an expert

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.
Reply With Quote
  #2  
Old 03-15-2010, 04:25 PM
llcooljabe's Avatar
llcooljabe llcooljabe is offline
Member
CAS
 
Join Date: Aug 2002
Favorite beer: Rickard's Red
Posts: 14,429
Default

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.
__________________
www.GoodNewsNow.info
Propoganda
Reply With Quote
  #3  
Old 03-15-2010, 04:32 PM
GadgetGeek's Avatar
GadgetGeek GadgetGeek is offline
Note Contributor
SOA AAA
 
Join Date: Sep 2001
Location: I'm here, where are you?
Studying for a way to escape
College: Illinois College ('87)
Favorite beer: Stag
Posts: 10,515
Default

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 4) save this as CopyAllMyPr0n.bat
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
Reply With Quote
  #4  
Old 03-15-2010, 04:40 PM
Ron Weasley's Avatar
Ron Weasley Ron Weasley is offline
Member
CAS AAA
 
Join Date: Oct 2001
Studying for naught.
Favorite beer: Butterbeer
Posts: 5,277
Default

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
Next, you can load this file into excel. Use commands to parse together lines like
Code:
copy <path><filename> I:\pictures\<filename>
Save these lines of text into the file \temp.bat. Then, from the command prompt, type

Code:
\temp
del \temp.csv
del \temp.bat
If things went well, you will now need to delete the original files
Code:
del <path>\*.* /s
Be very carefull with that last command. You don't want to hit the wrong directory.
Reply With Quote
  #5  
Old 03-15-2010, 05:01 PM
far_side far_side is offline
Member
 
Join Date: Jan 2005
Posts: 271
Default

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
Reply With Quote
  #6  
Old 03-15-2010, 05:05 PM
no
Guest
 
Posts: n/a
Default

Thanks all.
Reply With Quote
  #7  
Old 03-15-2010, 09:26 PM
Incredible Hulctuary's Avatar
Incredible Hulctuary Incredible Hulctuary is offline
Member
 
Join Date: Jan 2002
Posts: 19,011
Default

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
Reply With Quote
  #8  
Old 03-15-2010, 11:16 PM
Mojo Mojo is offline
Member
 
Join Date: Oct 2001
Posts: 1,092
Default

xcopy
http://www.petefreitag.com/item/99.cfm
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT -4. The time now is 06:23 PM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
*PLEASE NOTE: Posts are not checked for accuracy, and do not
represent the views of the Actuarial Outpost or its sponsors.
Page generated in 0.19780 seconds with 7 queries