General discussion

Move files up one directory

Hello,

I have the following situation:

I have log files stored in directories by date (C:\logs\01-01-2005, C:\logs\01-02-2005,
etc.). Inside each of these directories is another sub-directory (C:\logs\01-01-2005\logs\,
C:\logs\01-02-2005\logs\, etc.). I want to move the *.log files from the \logs\
directory up to the date directory.

I want to go from this:

C:\logs\01-02-2005\logs\01.log
C:\logs\01-02-2005\logs\02.log
C:\logs\01-02-2005\logs\03.log

To this:

C:\logs\01-02-2005\01.log
C:\logs\01-02-2005\02.log
C:\logs\01-02-2005\03.log

I've played around with some file managers and with 'xcopy', but I can't seem to
accomplish this task using an automated method. I started doing it manually, but
I have directories going back to 1995, and in each given \logs\ directory, there
are an average of 24 files.

Any help would be appreciated!

James

Discussion is locked

Follow
Reply to: Move files up one directory
PLEASE NOTE: Do not post advertisements, offensive materials, profanity, or personal attacks. Please remember to be considerate of other members. If you are new to the CNET Forums, please read our CNET Forums FAQ. All submitted content is subject to our Terms of Use.
Reporting: Move files up one directory
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Comments
- Collapse -
I see no easy way to do this

Windows doesn't lend itself easily to batch file movements.

But it shouldn't take you long to move the contents of each logs folder up a directory should it?

You say you have an average of 24 files in each log folder. I assume you know how to use Windows Explorer and how to select and cut and paste multiple files?

Why not select all the files in the first logs folder you want to empty, and instead of cutting and pasting, "drag" them over to the dated folder above the logs folder in the left pane of Windows Explorer. It would take 3 or 4 seconds per selection. Then right click the logs folder, and Shift+Delete to get rid of it.

Then move to the next dated folder. You could do 12 folders in a couple of minutes, and that's a year done. Multiply by 10 and you have less than an hours work.

Mark

- Collapse -
very easy

You can do it from a DOS command line,
being in your lower directory:
C:\logs\01-02-2005\
just type:
move *.log ..

The two dots ".." is DOS short hand for the parent directory.

If you want to do the same thing from a Windows click, just make a batch file with the same command line in it.
(for example call it "movelogsup.bat"

Drag it to whatever directory you want the action to be performed, and double-click movelogsup.bat

CNET Forums

Forum Info