Computing.Net > Forums > Programming > Move file to new folder namefile

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Move file to new folder namefile

Reply to Message Icon

Name: pieromobile
Date: May 15, 2009 at 02:49:27 Pacific
OS: Windows XP/Vista
Product: Hewlett-packard / 8710w
Subcategory: Batch
Comment:

hi,
this is my problem:

my folder:
file01_txt.txt
file01_img.pdg
file01_ocr.pdf
file01_001.tif
file01_002.tif
etc...
file02_txt.txt
file02_img.pdg
file02_ocr.pdf
file02_001.tif
file02_002.tif
etc...
......

1) read name file before "_" and create folder named "part file brfore _"
2) create sub-folder named "images"
3) move file file01_*.txt,pdf to folder "file01"
4) move file file01_#.tif to folder "file01\images"

Please help me!!!
Thx!
Piero



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: May 15, 2009 at 03:56:22 Pacific
Reply:

3) move file file01_*.txt,pdf to folder "file01"

I hope that comma is a typo.


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: pieromobile
Date: May 15, 2009 at 05:07:41 Pacific
Reply:

3) move file file01_*.txt,pdf to folder "file01" =
3) move file file01_*.txt & file01.pdf to folder "file01"

:)


0

Response Number 3
Name: Shaka
Date: May 15, 2009 at 16:47:57 Pacific
Reply:

It's not pretty. I am lazy. Don't know what to do with pdg files, but you should be able to see how to amend. Change the path pushd z:\your\path

@echo off & setlocal EnableDelayedExpansion
pushd z:\your\path
for %%a in (*) do (
set dirname=%%~na
md !dirname:~0,6!\images 2> nul
move !dirname:~0,6!*.tif !dirname:~0,6!\images
move !dirname:~0,6!*.pdg !dirname:~0,6!\images
move !dirname:~0,6!*.txt !dirname:~0,6!
move !dirname:~0,6!*.pdf !dirname:~0,6!
)
popd
exit


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Batch file to install mul... Read data from excel and ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Move file to new folder namefile

Copy Files to Folder with Same Name www.computing.net/answers/programming/copy-files-to-folder-with-same-name/15568.html

Moving files from one folder to diffrent www.computing.net/answers/programming/moving-files-from-one-folder-to-diffrent/18858.html

Move files to diff folders based on filename www.computing.net/answers/programming/move-files-to-diff-folders-based-on-filename/19872.html