avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday June 15, 2024, 2:23 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - lmoseley [ switch to compact view ]

Pages: [1]
Finished Programs / Re: DONE: Group files from within folders
« on: June 05, 2014, 11:57 PM »
Although old, I see that this post is still getting activity, so I may as well join in.  As it happens, just this week I had to solve this very problem.  I decided on a quick and dirty solution, which I will share.

I keep a temporary directory that I use just for this.  The temp dir contains one file, WALK.BAT.  Whatever directories I want to process, I either COPY or MOVE them to this directory.  Then, double-click WALK.BAT.

WALK.BAT contains a single batch file command, which I split into multiple lines here for readability:

FOR /D %%X IN (*.*) DO (
    CD %%X
    MOVE *.* ..
    CD ..

The /D tells the FOR statement to look only at directories, not files, and to process them one at a time.
*.* tells FOR to select all directories.
For each directory in the TEMP directory...
1. Change to that directory...
2. MOVE (or change to COPY) all files it finds there to the directory one level up, namely the TEMP dir that I am using
3. Change directory to the directory one level up, namely the TEMP dir
4. Repeat until done.

When moving, this takes only seconds to run, even for hundreds of source directories.


Pages: [1]