Anonymous_User Absent Member.
Absent Member.
3531 views

Help with a .bat file

Anybody know how to do this??

<snip>
Lance ,

I need a routine that will find and delete any folder ( and what it
contains) called " old version " or " old versions" is there a way to
make this a .bat file that i can run every so many days ?
<snip
Labels (1)
0 Likes
12 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Help with a .bat file

Lance Reynolds scribbled something like:

> I need a routine that will find and delete any folder ( and what it
> contains) called " old version " or " old versions" is there a way to
> make this a .bat file that i can run every so many days ? <snip


Not sure about getting rid of the actual folder, but the DEL command
should work for the files in that folder.

DEL /F /Q "<path to folder>"
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Help with a .bat file

what about using * in the folder path...

--
"Moldy mildew, mother of mouthmuck, dangle and strangle to death." She
said.
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Help with a .bat file

Lance Reynolds wrote:
> I need a routine that will find and delete any folder ( and what it
> contains) called " old version " or " old versions" is there a way to
> make this a .bat file that i can run every so many days ?


Well, you might be able to use something like:

FOR /R %%D IN (.) DO IF EXIST "%%D\old version" DEL /S "%%D\old version"

.... that should find any directories called "old version" anywhere
underneath the current folder, and delete them. I think 🙂

--
Regards,
Ben A L Jemmett
http://flatpack.microwavepizza.co.uk/
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Help with a .bat file

To delete all from the root down, try:-

FOR /F %d IN (`DIR \"old version?" /ad/s/b`) DO RMDIR "%d" /S /Q
Or to play safe
FOR /F %d IN (`DIR \"old version" /ad/s/b`) DO RMDIR "%d" /S /Q
FOR /F %d IN (`DIR \"old versions" /ad/s/b`) DO RMDIR "%d" /S /Q

Don't forget to double up on the %s when including it in a batch file. i.e.
use %%d not %d

Untested, but it should work.


Heff.


"Lance Reynolds" <lanceNO@SPAMsatco.biz> wrote in message
news:6jitj.1546$Ec7.1476@kovat.provo.novell.com...
> Anybody know how to do this??
>
> <snip>
> Lance ,
>
> I need a routine that will find and delete any folder ( and what it
> contains) called " old version " or " old versions" is there a way to make
> this a .bat file that i can run every so many days ?
> <snip



0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Help with a .bat file

Lance Reynolds wrote:
> Anybody know how to do this??
>
> <snip>
> Lance ,
>
> I need a routine that will find and delete any folder ( and what it
> contains) called " old version " or " old versions" is there a way to
> make this a .bat file that i can run every so many days ?
> <snip

FDISK? 🙂

Brad
0 Likes
Sewermonger Absent Member.
Absent Member.

Re: Help with a .bat file

I think this should be asked over in the Batman forums. Just an
observation though and it may not help as I get hit in the head with a
bat when I go there.
--



0 Likes
Sewermonger Absent Member.
Absent Member.

Re: Help with a .bat file

IEPrivacyKeeper has a function that will delete a folder and it's
contents.
--



0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Help with a .bat file

Looks like you're the winner, Ben. Thanks so much!

And thanks to everyone else for responding...even the FDISK! 🙂

Lance
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Help with a .bat file

Lance Reynolds scribbled something like:

> Looks like you're the winner, Ben. Thanks so much!


No fair! Just cuz he's smarter than me. <G>
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Help with a .bat file

Stevo wrote:
> Lance Reynolds scribbled something like:
>
>> Looks like you're the winner, Ben. Thanks so much!

>
> No fair! Just cuz he's smarter than me. <G>


Me too! 🙂
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Help with a .bat file

Lance Reynolds wrote:
> Looks like you're the winner, Ben. Thanks so much!
>
> And thanks to everyone else for responding...even the FDISK! 🙂
>
> Lance

🙂 Glad to be of service.

Brad
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Help with a .bat file

"Ben A L Jemmett" <bal.jemmett@ukonline.co.uk> wrote in
news:xn0fmgz1shae8z001@forums.novell.com:

>
> Well, you might be able to use something like:
>
> FOR /R %%D IN (.) DO IF EXIST "%%D\old version" DEL /S "%%D\old version"
>
> ... that should find any directories called "old version" anywhere
> underneath the current folder, and delete them. I think 🙂


The "forfiles" tool is part of the resource admin packs in Windows. It
does stuff like this too.
I think you might like it. I only found out about it last week 8), but it
has been around since NT4...

--
Ciao, Dave
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.