Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Batch File

Original Message
Name: morphine
Date: March 29, 2005 at 08:00:39 Pacific
Subject: Batch File
OS: NT
CPU/Ram: 1 GB
Comment:

I have a folder on our network with the following directory's:

- Mon
- Tues
- Wed
- Thur
- Fri
- Sat
- Sun

These folders contain database backup files that are pretty large.
The server is getting low on disk space and I
want to create a batch file that will do the following:

Monday delete the contents of the Thu folder
Tuesday delete the contents of the Fri folder
Wednesday delete the contents of the Mon folder
Thursday delete the contents of the Tue folder
Friday delete the contents of the Wed folder

Is this possible?


Report Offensive Message For Removal


Response Number 1
Name: dtech10
Date: March 29, 2005 at 08:18:10 Pacific
Subject: Batch File
Reply: (edit)
Hi
I take your using the Command Prompt in NT.
What format doe's the "echo %Date%" command produce in NT as I think it's different from WinXP by echoing the Day of the week before the date is this so.


Report Offensive Follow Up For Removal

Response Number 2
Name: morphine
Date: March 29, 2005 at 08:24:45 Pacific
Subject: Batch File
Reply: (edit)
When I typed echo %Date% at the NT command prompt it just returned %date%.
Is that what you mean?

Report Offensive Follow Up For Removal

Response Number 3
Name: rogerashley
Date: March 29, 2005 at 08:29:14 Pacific
Subject: Batch File
Reply: (edit)
Are you wanting a "Standalone MS DOS and compatible" or "NT solution" ??, they are quite often different. If it is an NT solution it may be wise to post in the Programming or your O/S Forum

DO NOT BAN THE MESSENGER


Report Offensive Follow Up For Removal

Response Number 4
Name: morphine
Date: March 29, 2005 at 08:36:51 Pacific
Subject: Batch File
Reply: (edit)
I just want to create a batch file and run it from the task scheduler in NT.

Report Offensive Follow Up For Removal

Response Number 5
Name: dtech10
Date: March 29, 2005 at 08:50:28 Pacific
Subject: Batch File
Reply: (edit)
Hi
Not sure about the task scheduler in NT.
what doe's this command produce "date /t"



Report Offensive Follow Up For Removal


Response Number 6
Name: morphine
Date: March 29, 2005 at 09:00:00 Pacific
Subject: Batch File
Reply: (edit)
Tue 03/29/2005

Report Offensive Follow Up For Removal

Response Number 7
Name: dtech10
Date: March 29, 2005 at 09:11:55 Pacific
Subject: Batch File
Reply: (edit)
@echo off
Set Day=%XDate:~0,3%

echo %Day%

if '%Day%=='Mon echo del /q \Thu\*.*
if '%Day%=='Tue echo del /q \Fri\*.*
if '%Day%=='Wed echo del /q \Mon\*.*
if '%Day%=='Thu echo del /q \Tue\*.*
if '%Day%=='Fri echo del /q \Wed\*.*


rem The /q deletes without asking confirmation change as required. Works in XP ok. Type "del /?" for more info.
rem Delete the echo's there there just for safety.


Report Offensive Follow Up For Removal

Response Number 8
Name: dtech10
Date: March 29, 2005 at 09:16:26 Pacific
Subject: Batch File
Reply: (edit)
Sorry Forget To add First Line

@echo off
for /f %%a in ('date /t') do set XDate=%%a
Set Day=%XDate:~0,3%

echo %Day%

if '%Day%=='Mon echo del /q \Thu\*.*
if '%Day%=='Tue echo del /q \Fri\*.*
if '%Day%=='Wed echo del /q \Mon\*.*
if '%Day%=='Thu echo del /q \Tue\*.*
if '%Day%=='Fri echo del /q \Wed\*.*


rem The /q deletes without asking confirmation change as

required. Works in XP ok. Type "del /?" for more info.
rem Delete the echo's there there just for safety.


Report Offensive Follow Up For Removal

Response Number 9
Name: rogerashley
Date: March 29, 2005 at 09:16:54 Pacific
Subject: Batch File
Reply: (edit)
Does this work in MS DOS 6.22 standalone ???

DO NOT BAN THE MESSENGER


Report Offensive Follow Up For Removal

Response Number 10
Name: dtech10
Date: March 29, 2005 at 09:22:13 Pacific
Subject: Batch File
Reply: (edit)
Hi rogerashley
No. But neither does NT task scheduler.
Write one for standalone DOS if required, but would need to write a debug script to obtain the Day-of-week.



Report Offensive Follow Up For Removal

Response Number 11
Name: morphine
Date: March 29, 2005 at 09:54:05 Pacific
Subject: Batch File
Reply: (edit)
I was unable to get this to work.
I guess I will just create 5 seperate batch files for each day of the week and do it that way. Thanks for the help.



Report Offensive Follow Up For Removal

Response Number 12
Name: rogerashley
Date: March 29, 2005 at 09:58:58 Pacific
Subject: Batch File
Reply: (edit)
So if this is not for MS DOS 6.22 standalone how come it is in this forum?, and how relevent is it to MS DOS and compatible users?

http://83.67.55.228/

DO NOT BAN THE MESSENGER


Report Offensive Follow Up For Removal

Response Number 13
Name: rogerashley
Date: March 29, 2005 at 10:01:02 Pacific
Subject: Batch File
Reply: (edit)
morphine you try the programming forum as dtech10 pointed out NT tsak scheduler is not in DOS Standalone, which is what this forum is for!!!!!!!!!!!!!!!

DO NOT BAN THE MESSENGER


Report Offensive Follow Up For Removal

Response Number 14
Name: rogerashley
Date: March 29, 2005 at 10:02:30 Pacific
Subject: Batch File
Reply: (edit)
"Below is the DOS Standalone message area. This forum is for all Standalone versions of DOS, not the "DOS" prompt contained inside later versions of Windows."


This is what is at top of FORUM written by JW

DO NOT BAN THE MESSENGER


Report Offensive Follow Up For Removal

Response Number 15
Name: Mechanix2Go
Date: March 29, 2005 at 10:30:33 Pacific
Subject: Batch File
Reply: (edit)
dtech10 et al,

This should work in most DOS anf NT:

::**
@echo off > quit.bat
echo.|date>today

:TUE
find /i "TUE" < today > nul
if errorlevel 1 goto WED
del FRI
quit

:WED
find /i "WED" < today > nul
if errorlevel 1 goto THU
del MON
quit

:THU
find /i "THU" < today > nul
if errorlevel 1 goto FRI
del TUE
quit

:: and so on
::**

Notes:

For versions which support it, use del /q.

For others, use echo y|del

The default file mask for a DEL is *.*, so this:

del thu

is equivalent to:

del thu\*.*

Also, this uses FIND but no DEBUG.

For versions of FIND which do not support /i it will need to have the day string hardwired. "Tue" NOT "TUE".


For a bat to get DAY DATE & TIME into vars using NO external commands, see my world famous DTWINALL posted several months ago.


M2

If at first you don't succeed, you're about average.


Report Offensive Follow Up For Removal

Response Number 16
Name: Mechanix2Go
Date: March 29, 2005 at 10:46:19 Pacific
Subject: Batch File
Reply: (edit)
Hi Morphine,

Try #15.

The Set Day=%XDate:~0,3% is much more elegant, but depends on the date layout on the particular box.

Read the notes. As is it will prompt you to confirm the DEL. After you are comfortable with the script you can tailor it to run with no prompt.

Wide ranging deletes with an untested script are a BAD idea.

Not also that as written by dtech10, the directories to be cleared are off the root.

The one I wrote assumes the BAT is in the directoru immediately above the data dirs.

You can hardwire the paths or, much better, lead in with a CD.

HTH


M2

If at first you don't succeed, you're about average.


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Batch File 

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




how to setup call of duty to joytok

WindowsME / HotMail Problem

Corrupt memory

Convert fat32 to Ntfs

Best WinMo phone of 2008


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC