start loop from specific folder

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
smurfsmurfsmurf
Posts: 1
Joined: 18 Jan 2017 06:55

start loop from specific folder

#1 Post by smurfsmurfsmurf » 18 Jan 2017 08:12

Hay ho
I'm not sure if im correct here, but im trying.

At the moment i am trying to make a command line code run from vba editor in excel.

Therefore I need the following Code in one line, but I'm unable to change it in that way.

Code is following:

cd c:\users\flori\Documents\Bestellwesen\zbackup
for /f "skip=2 delims=" %F in ('dir *.* /B /O-D /A-D') do del "%F"

Is there a possibility to get thos two lines compressed in only one?

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: start loop from specific folder

#2 Post by Squashman » 18 Jan 2017 08:58

Put the folder path in your DIR command.

Post Reply