Hardware Canucks

Hardware Canucks (http://www.hardwarecanucks.com/forum/)
-   O/S's, Drivers & General Software (http://www.hardwarecanucks.com/forum/o-ss-drivers-general-software/)
-   -   Batch files. (http://www.hardwarecanucks.com/forum/o-ss-drivers-general-software/36906-batch-files.html)

encorp October 7, 2010 03:38 PM

Batch files.
 
I dunno if this is the best section for this, buuuut whatever.

It's been years since I touched a batch file. Anyone interested in helping me write one?

I want to empty out a folder every time I reboot. I've got a folder on a disk where chrome saves anything I specifically download (Not cache, cookies etc)

I want it to clear automatically for me. I can handle the syntax regarding folder/drive locations I just don't know what commands to use...


duuuur

Thanks!

CMetaphor October 7, 2010 03:46 PM

Oh man its been a while... but i might be able to get you going in the right direction, as I think it's fairly simple...

cd c:\<insert your path to folder with the files to be deleted>
del *.*

write that in notepad or similar, save as .bat and put in your startup folder. Done?

encorp October 7, 2010 03:53 PM

Quote:

Originally Posted by CMetaphor (Post 436815)
Oh man its been a while... but i might be able to get you going in the right direction, as I think it's fairly simple...

cd c:\<insert your path to folder with the files to be deleted>
del *.*

write that in notepad or similar, save as .bat and put in your startup folder. Done?

God, wait.. it's that easy?

Haha those commands are so old school.. I really didn't think it'd be that simple..

Thanks!

If anyone else knows different; let me know!

CMetaphor October 7, 2010 04:08 PM

Quote:

Originally Posted by encorp (Post 436820)
God, wait.. it's that easy?

Haha those commands are so old school.. I really didn't think it'd be that simple..

Thanks!

If anyone else knows different; let me know!

No prob dude. you can always just try out the commands to a batch file one at a time by typing them in an ms-dos command windows too btw...

encorp October 7, 2010 04:29 PM

The "are you sure" prompt comes up when I run it manually.. will that get in the way?

EDIT: Oddly enough, running it manually does NOT work. I put files in the folder and I can't delete them. I receive no errors or messages in cmd. It just goes through with it but the files are still there.


I know those commands work, I've used em billion times lol

sswilson October 7, 2010 04:41 PM

Can you delete the contents of the folder from within windows?

encorp October 7, 2010 04:44 PM

Quote:

Originally Posted by sswilson (Post 436845)
Can you delete the contents of the folder from within windows?

Yep!

I even ran cmd in admin mode.

It didn't do anything to the files in the folder lol.

sswilson October 7, 2010 04:49 PM

Heh... gotta be an authority thing... I'm not currently on a win7 machine.... does the /? switch for del at the command line offer a switch for "do it no matter what!!!" ?

Desiato October 7, 2010 05:04 PM

Try: "del /q /f /s c:\path\to\your\dir\."

(excluding the quotes of course)

sswilson October 7, 2010 05:04 PM

under XP it's /f (force deletion of read only) /s (subdirectories) /q (quiet no prompt)......

Be very careful of how you write it if you include the /q though.... Not sure about win7, but XP defaults to the documents and settings\username so if the CD doesn't work that plus all of the subdirectories is what will be deleted without a prompt..... (I'd test it out without the /Q first..... ;)


All times are GMT -7. The time now is 02:26 PM.