Move file to new folder namefile

Hewlett-packard / 8710w
May 15, 2009 at 02:49:27
Specs: Windows XP/Vista
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


See More: Move file to new folder namefile

Report •


#1
May 15, 2009 at 03:56:22
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


Report •

#2
May 15, 2009 at 05:07:41
3) move file file01_*.txt,pdf to folder "file01" =
3) move file file01_*.txt & file01.pdf to folder "file01"

:)


Report •

#3
May 15, 2009 at 16:47:57
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


Report •

Related Solutions


Ask Question