Page Index Toggle Pages: 1 [2]  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) File Duplication Utility (Read 2627 times)
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: File Duplication Utility
Reply #15 - Apr 5th, 2006 at 6:56pm
Print Post Print Post  
Hello Scott,

Here is a more advanced version. The code below will clear out all files in the directory specified that have a .mp3 file extension.

Code
Select All
Var vName as String
Var vLoop as Int
Var vCnt as Int
Var vStatus as Int
Var vFiles as String
Var vHandle as Int
Var vDirectory as String

vDirectory = "C:\Sesame\Music\"

vStatus = @Shell("dir " + vDirectory + " /b > " + vDirectory + "DirectoryListing.txt")

If vStatus = 0 Then
{
	vFiles = @Insert(vDirectory +"DirectoryListing.txt")
	vFiles = @Replace(vFiles, @Newline(), ";")
	vFiles = @SearchStringArray(vFiles, "..\.mp3")
	vCnt = @CountStringArray(vFiles)
	vLoop = 1

	If @AskUser("This will clear " + @Str(vCnt) + " Files.", "Are you sure you want to continue", "") Then
	{
		While vLoop <= vCnt
		{
			vName = @AccessStringArray(vFiles, vLoop)
			FileDelete(vDirectory + vName)
			vHandle = FileOpen(vDirectory + vName)
			FileClose(vHandle)
			vLoop = vLoop + 1
		}
	}
	FileDelete(vDirectory + "DirectoryListing.txt")
} 



Use at your own risk, same as the other one I posted.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: File Duplication Utility
Reply #16 - Apr 5th, 2006 at 7:05pm
Print Post Print Post  
Thanks Ray, those look interesting.  And scary.

What kind of form & elements would I need to create to use these?  And when you say "clear" are these programs actually deleting the file (and the filename) or just the contents (leaving the filename) or deleting the file & filename and then re-creating zero-byte files with the pre-existing filenames?
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: File Duplication Utility
Reply #17 - Apr 5th, 2006 at 7:19pm
Print Post Print Post  
Hello Scott,

You can either make a command button or run the code in a Mass Update on one record. Either way works.

The code is deleting the existing files and then creating new files with the same names, that have nothing in them. So number three is the correct answer.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: File Duplication Utility
Reply #18 - Apr 5th, 2006 at 7:56pm
Print Post Print Post  
Thanks Ray!  (I'm gonna put this response on a macro.) Smiley
  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: File Duplication Utility
Reply #19 - Apr 19th, 2006 at 4:48pm
Print Post Print Post  
I'm not sure if anyone is still interested, but I was in another forum and posted my curiosity about a program to "zero out" multiple files while retaining their filenames.  (The suggestions offered here were great and I have made use of them, but I was still looking for something that would deflate hundreds of files in one fell swoop.)

In response, a software writer named Robert Clark wrote a batch file that does this using the DOS "type NUL>filename" command.  Is anyone interested in seeing this code?
  

**
Captain Infinity
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: File Duplication Utility
Reply #20 - Apr 19th, 2006 at 8:35pm
Print Post Print Post  
Hi Scott...


I am always interested to see how others solve problems.  Would like to see what you have, thanks.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send Topic Send Topic Print Print