Deleting backup files

Bernard Aschwanden (Publishing Smarter) bernard at publishingsmarter.com
Fri Dec 2 05:45:56 PST 2011


Before you read further, realize that the consequence of using a batch command to delete files can impact a lot of what you have on
a computer. The samples that were previously provided, as well as the update I suggest, can dramatically change the landscape. Using
this stuff incorrectly, or in the wrong place is a bit like using a backhoe to move a kids swing set. Sure, it works, and if you do
it well, it works with no negative issues, but if you do it wrong the whole thing crashes down around you.

SO, DON'T USE THIS CODE/BATCH FILE UNLESS YOU REALLY THINK THROUGH WHAT YOU ARE DOING.

Now that the "Danger Will Robinson" moment has passed, let's move on.

I'd suggest one more quick change to the code...

The line in step 5 reads:
del /s *backup*  *.log  *.tps  *.tpdf

I would suggest changing it to:
del /s /q *.backup.fm *.log *.tps *.tpdf

The update to *.backup.fm ensures you don't accidently delete a file named, for example, "create_backups.fm" which you don't want to
remove, but "create_backups.backup.fm" WOULD be deleted. The addition of /q runs "quiet" and won't prompt you for anything, it will
just wipe files.

Also, I have a tiny file that I created that does basically the same thing. First, I create a text file, put in the code I need,
then rename that file to .bat instead of .txt

Then, and do this carefully, I place the .bat file into a folder (using Windows Explorer) that is the root for the backup files you
need to wipe. Then, again in Explorer, dbl click the .bat. So I may create the batch, put it into E:\mydocs\FM\DITA_User_Guide\ and
that has 5 subfolders, and 10,000 topics, including a lot of backup files, log files, temp files, temp PDF. Then, in that folder, I
double click. About 30 seconds later all 10,000 files are reviewed and what I don't need is wiped.

BE REALLY REALLY REALLY REALLY REALLY REALLY careful with this. If you accidently have *.fm in your .bat file, OR you put it into a
map to a server, or some folder where you didn't mean to do this, you can wipe a LOT more than you planned. The *.log file (as an
example) is used in a lot more places than just Frame and PDF generation. You would NOT want to do this on your C: drive either.

Lastly, this method works way faster than the Windows Explorer 'find' feature as it will just wipe the files with any of the four
extensions. To do it via Explorer may mean you take extra time to find each type, search, select, delete. The *.bat is super fast,
but can have dangerous consequences.

Hope that helps out.

Bernard


Bernard Aschwanden
Publishing Smarter
www.publishingsmarter.com

Write Less. Write Better.




-----Original Message-----
From: framers-bounces at lists.frameusers.com [mailto:framers-bounces at lists.frameusers.com] On Behalf Of Syed Zaeem Hosain
(Syed.Hosain at aeris.net)
Sent: November-30-11 23:41
To: Theresa de Valence; framers at lists.frameusers.com
Subject: RE: Deleting backup files

1. Open a DOS command prompt window.

2. Navigate to the directory of choice. If the directory name is long, or has spaces in it, enclose it in double quotes (like this
"cd  \tree  name\folder  name\"  for example).

4. Make a copy of everything before deleting the backups (in case something goes wrong!). I do it like this in the directory where I
am:

		mkdir  BACKFILES
		copy  *.*  BACKFILES\*.*  /v

5. Then delete the FrameMaker backup and log files you want to (this is what I use for example):

		del   *backup*  *.log  *.tps  *.tpdf

	 Be careful above! Do NOT have any spaces beween the '*' characters and the other characters.

	By the way, I keep the above del line in a text file called "cleanframe.bat" (in my DOS command path somewhere) so that I
just type "cleanframe" rather than take a risk of accidentally putting in spaces in the wrong place and deleting the wrong files!

6. After you are comfortable that you still have what you need, you remove the other files *if you want*:

		rmdir  /s  /q  BACKFILES

	Again, be careful of what you are removing!

Ultimately, having a complete backup (in case of recovery needs) is a good a idea before you start any of this - just to be safe.

Good luck,

Z

-----Original Message-----
From: framers-bounces at lists.frameusers.com [mailto:framers-bounces at lists.frameusers.com] On Behalf Of Theresa de Valence
Sent: Wednesday, November 30, 2011 3:11 PM
To: framers at lists.frameusers.com
Subject: Deleting backup files

Could someone please give me a command for deleting backup files in Windows (Windows 7)?

This is for the end of the project when I am no longer opening all the working files.

I'd like the command to work in the current directory and all subdirectories.

I vaguely remember how to do this in DOS, but I don't know how to navigate directories which are longer than 8 chars!

Many thanks,
Theresa
_______________________________________________


You are currently subscribed to framers as Syed.Hosain at aeris.net.

Send list messages to framers at lists.frameusers.com.

To unsubscribe send a blank email to
framers-unsubscribe at lists.frameusers.com
or visit http://lists.frameusers.com/mailman/options/framers/syed.hosain%40aeris.net

Send administrative questions to listadmin at frameusers.com. Visit http://www.frameusers.com/ for more resources and info.

_______________________________________________


You are currently subscribed to framers as bernard at publishingsmarter.com.

Send list messages to framers at lists.frameusers.com.

To unsubscribe send a blank email to
framers-unsubscribe at lists.frameusers.com
or visit http://lists.frameusers.com/mailman/options/framers/bernard%40publishingsmarter.com

Send administrative questions to listadmin at frameusers.com. Visit
http://www.frameusers.com/ for more resources and info.




More information about the framers mailing list