Jump to content

Recommended Posts

Posted

I've got another small batch file job that I'm hoping people can help me out with.

I'm trying to create a batch file that will take all the non-links from the desktop and move them to a folder, including directories.

This is what I've got so far...

@echo off&setlocal enableextensions

set src=C:\Documents and Settings\Administrator\Desktop
set dest=C:\Documents and Settings\Administrator\My Documents\Desktop

pushd %src%

for /f "tokens=*" %%a in ('dir/b/a') do (
   IF /I %%~xa NEQ .lnk (
robocopy %%a %dest% /S /MOVE>nul
   )
)
popd&endlocal&goto :eof

When I run this... nothing happens...

Any ideas/suggestions would be appreciated. :)


Posted (edited)

You can just use the exclude option in robocopy, for example:

@echo off

set src=C:\Documents and Settings\Administrator\Desktop
set dest=C:\Documents and Settings\Administrator\My Documents\Desktop

robocopy "%src%" "%dest%" /copyall /mov /xf *.lnk /r:30 /w:10>nul

goto :eof

<Edit>

Replaced my test dirs with your %src% and %dest%

</Edit>

Edited by Yzöwl
Posted
what's included in XP? :}
'robocopy' is not recognized as an internal or external command,

operable program or batch file.

Wierd... I've got it on my laptop and I haven't installed any extra packs... :wacko:

Maybe it's XP Pro? :unsure:

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...