MSFN Forum: [CMD] Move all non-links - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[CMD] Move all non-links Rate Topic: -----

#1 User is offline   Zxian 

  • Scroll up - see the Google bar?
  • Group: Super Moderator
  • Posts: 5,066
  • Joined: 30-September 04
  • OS:none specified
  • Country: Country Flag

Posted 05 October 2005 - 02:27 PM

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. :)


#2 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,195
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 06 October 2005 - 04:14 AM

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>

This post has been edited by Yzöwl: 06 October 2005 - 06:24 AM


#3 User is offline   Zxian 

  • Scroll up - see the Google bar?
  • Group: Super Moderator
  • Posts: 5,066
  • Joined: 30-September 04
  • OS:none specified
  • Country: Country Flag

Posted 06 October 2005 - 12:03 PM

That would probably work... :)

I'll test it out tomorrow. Thanks!

#4 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 06 October 2005 - 02:52 PM

robocopy = this?

#5 User is offline   Zxian 

  • Scroll up - see the Google bar?
  • Group: Super Moderator
  • Posts: 5,066
  • Joined: 30-September 04
  • OS:none specified
  • Country: Country Flag

Posted 06 October 2005 - 02:59 PM

Yup... it's included by default in XP, but not in 2K.

#6 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 06 October 2005 - 04:51 PM

what's included in XP? :}

Quote

'robocopy' is not recognized as an internal or external command,
operable program or batch file.


#7 User is offline   Zxian 

  • Scroll up - see the Google bar?
  • Group: Super Moderator
  • Posts: 5,066
  • Joined: 30-September 04
  • OS:none specified
  • Country: Country Flag

Posted 06 October 2005 - 04:58 PM

View Postprathapml, on Oct 6 2005, 02:51 PM, said:

what's included in XP? :}

Quote

'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:

#8 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 06 October 2005 - 05:06 PM

View PostZxian, on Oct 7 2005, 04:28 AM, said:

Maybe it's XP Pro? :unsure:
Thats what i have!
Pro, SP2 :}

#9 User is offline   Zxian 

  • Scroll up - see the Google bar?
  • Group: Super Moderator
  • Posts: 5,066
  • Joined: 30-September 04
  • OS:none specified
  • Country: Country Flag

Posted 06 October 2005 - 07:30 PM

Wierd... :wacko:

#10 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,020
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 06 October 2005 - 08:33 PM

Wrong Post My Mistake

This post has been edited by gunsmokingman: 06 October 2005 - 10:25 PM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy