CMD - Move files to the folders dependent on the list? -
i have list (list.txt) content:
c:\users\computers\39323227
c:\users\computers\39323227.zip
c:\users\computers\39328635
c:\users\computers\39328635.zip
c:\users\computers\39329113.zip
c:\users\computers\39329288.zip
c:\users\computers\39331075
c:\users\computers\39331075.zip
c:\users\computers\39331386.zip
c:\users\computers\39904282
c:\users\computers\39904282.zip
c:\users\computers\39905798
c:\users\computers\39905798.zip
c:\users\computers\39906307.zip
and files , created folders in parent folder clutter this:
c:\users\computers\39323227
c:\users\computers\39328635
c:\users\computers\39331075
c:\users\computers\39904282
c:\users\computers\39905798
c:\users\computers\39323227.zip
c:\users\computers\39328635.zip
c:\users\computers\39329113.zip
c:\users\computers\39329288.zip
c:\users\computers\39331075.zip
c:\users\computers\39331386.zip
c:\users\computers\39904282.zip
c:\users\computers\39905798.zip
c:\users\computers\39906307.zip
is possible write cmd move files folders below? :
c:\users\computers\39323227\39323227.zip
c:\users\computers\39328635\39328635.zip
c:\users\computers\39328635\39329113.zip
c:\users\computers\39328635\39329288.zip
c:\users\computers\39331075\39331075.zip
c:\users\computers\39331075\39331386.zip
c:\users\computers\39904282\39904282.zip
c:\users\computers\39905798\39905798.zip
c:\users\computers\39905798\39906307.zip
if not, suggest there soft me solve problem?
@echo off setlocal enabledelayedexpansion /f "delims=" %%a in (q22540287.txt) ( if "%%~xa"==".zip" ( rem echo md "!destdir!\" echo move "%%a" "!destdir!\" ) else (set "destdir=%%~dpna") ) goto :eof
i used file named q22540287.txt
containing data testing.
the required move commands merely echo
ed testing purposes. after you've verified commands correct, change echo move
move
move files. append >nul
suppress report messages (eg. 1 file moved
)
i've added in line ensure selected destination directory exists. activate feature, remove rem
md...
line. required md commands merely echo
ed testing purposes. after you've verified commands correct, change echo md
md
create directories. append 2>nul
suppress error messages (eg. when directory exists)
results me (noting changed c:
u:
testing)
move "u:\users\computers\39323227.zip" "u:\users\computers\39323227\" move "u:\users\computers\39328635.zip" "u:\users\computers\39328635\" move "u:\users\computers\39329113.zip" "u:\users\computers\39328635\" move "u:\users\computers\39329288.zip" "u:\users\computers\39328635\" move "u:\users\computers\39331075.zip" "u:\users\computers\39331075\" move "u:\users\computers\39331386.zip" "u:\users\computers\39331075\" move "u:\users\computers\39904282.zip" "u:\users\computers\39904282\" move "u:\users\computers\39905798.zip" "u:\users\computers\39905798\" move "u:\users\computers\39906307.zip" "u:\users\computers\39905798\"
Comments
Post a Comment