xmove command script

144 views
Skip to first unread message

ad...@reviews.wox.org

unread,
Jun 19, 2023, 10:22:34 PM6/19/23
to 2600-au...@googlegroups.com
Needed to do this enough times I got annoyed and made a
batch script that does it.  Probably a tool somewhere that
does it but this lets you see what it actually does in the code.

If you need to move all files of a given wildcard  (*.jpg
for example) from all sub directories to a folder 
(something after doing a hard disk recovery is sort of
helpful to file them)  try this script, which i usually name
xmove.bat

@echo off
IF [%1]==[] (
GOTO usage
)
echo We have a file spec %1
IF [%2]==[] (
GOTO usage
)
echo We have a folder %2 to scan subfolders for %1
IF [%3]==[] (
GOTO usage
)
echo We have a folder %3 to move %1 to %3
IF NOT [%4]==[] (
echo too many parameters  %4
GOTO eof
)

echo lets do this:  move everything of file spec %1  from
%2   to %3 and make %3 if it doesnt exist
pause
md %3
for /R %%d in (%1) do (
move "%%d" %3 > nul
echo "%%d" %3
)

GOTO eof

:usage
echo Moves all files of given type from all subdirectories
to destination specified
echo usage xmove filespec source destination
echo example xmove *.jpg c:\fromhere  c:\to_here
echo Please note tool does not support spaces in source or
destination filename
echo but when moving it will move files in subdirectories
echo if the source folder has a space, go into that folder
first using cd "f o l d e r"
echo then use .\ as source

--
New and improved 2600... well.. ..we drew on some flames and polished it a bit..
--
Google - making sure, life is no more, than 1984...
--
In politics - Later never happens.

ad...@reviews.wox.org

unread,
Jun 19, 2023, 10:32:42 PM6/19/23
to 2600-au...@googlegroups.com
Curses cut and paste!

There should be an

:eof

at the end :  pasted again but with eof this time:
:eof
Reply all
Reply to author
Forward
0 new messages