Hot Topic (More than 10 Replies) File Duplication Utility (Read 2652 times)
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
File Duplication Utility
Mar 31st, 2006 at 2:05pm
Print Post Print Post  
I just knocked together a small Windows utility in VB at someone's request. It allows you to make multiple uniquely named copies of a file. You select a file, enter the number of copies, enter a starting value for the prefix/suffix and it makes the file copies.

Anybody else have a use for this somewhat esoteric thing? If so, let me know. I'll give you a download link.
  

- Hammer
The plural of anecdote is not data.
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 #1 - Mar 31st, 2006 at 6:11pm
Print Post Print Post  
Ping.
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: File Duplication Utility
Reply #2 - Mar 31st, 2006 at 6:22pm
Print Post Print Post  
  

- Hammer
The plural of anecdote is not data.
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 #3 - Apr 5th, 2006 at 2:35pm
Print Post Print Post  
Thanks, that's pretty cool.
  

**
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 #4 - Apr 5th, 2006 at 2:41pm
Print Post Print Post  
Here's a utility I've been looking for for a while: something that will overwrite a bunch of files as zero-bit files without changing the filenames.

I collect Old Time Radio programs, MP3 files.  Once I get a CD's worth on my hard drive, I burn them to disk.  I'd then like to delete the data from the hard drive, reclaiming the disk space.  But in order to avoid duplication of time and effort in tracking down the missing episodes of a series, I'd like to keep the filenames present, so a "this file already exists" message will pop up if I try to collect a show again.

Does anyone know if such a thing exists?  I've searched with Google, Tucows, various other shareware and freeware utility sites, to no avail.
  

**
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 #5 - Apr 5th, 2006 at 3:08pm
Print Post Print Post  
It sounds like you want to keep the filenames, but have a Zero size?  You could probably do this with Sesame.


Steps:
Select file name to be deleted.
Capture the file name as a variable
Append the variable to a text file OldFiles.txt, that holds a list of deleted files. 
Delete the file.

When getting a new file, do a search of the OldFiles.txt file.  If name not found, then download the file.
If name is found, proceed to next name to download, and loop until last filename has been examined.

Or if you want to keep filename in folder vs. in a text file, then after you delete the file, use I/O to create an empty file with the same name.

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: File Duplication Utility
Reply #6 - Apr 5th, 2006 at 3:15pm
Print Post Print Post  
Quote:
Here's a utility I've been looking for for a while: something that will overwrite a bunch of files as zero-bit files without changing the filenames.

I collect Old Time Radio programs, MP3 files.  Once I get a CD's worth on my hard drive, I burn them to disk.  I'd then like to delete the data from the hard drive, reclaiming the disk space.  But in order to avoid duplication of time and effort in tracking down the missing episodes of a series, I'd like to keep the filenames present, so a "this file already exists" message will pop up if I try to collect a show again.

Does anyone know if such a thing exists?  I've searched with Google, Tucows, various other shareware and freeware utility sites, to no avail.


You can do this with Sesame!  Grin

No, really. The File I/O routines can do this. You can get your list of files, delete each file on the list, then write a new file of the same name with no content (or the content of your choice, like the date deleted or how you liked the program).
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: File Duplication Utility
Reply #7 - Apr 5th, 2006 at 3:19pm
Print Post Print Post  
Quote:
Here's a utility I've been looking for for a while: something that will overwrite a bunch of files as zero-bit files without changing the filenames.

I collect Old Time Radio programs, MP3 files.  Once I get a CD's worth on my hard drive, I burn them to disk.  I'd then like to delete the data from the hard drive, reclaiming the disk space.  But in order to avoid duplication of time and effort in tracking down the missing episodes of a series, I'd like to keep the filenames present, so a "this file already exists" message will pop up if I try to collect a show again.

Does anyone know if such a thing exists?  I've searched with Google, Tucows, various other shareware and freeware utility sites, to no avail.



Does now. Here is command line utility that accepts the filename as an argument.

syntax:
Code
Select All
zero_it filename
 



http://www.HammerVE.com/SesameImages/zero_it.exe

Use it very carefully. It does indeed destroy the content of any file you aim it at, leaving just the empty file behind. It does not confirm anything or ask twice.

The usual provisions about how I am not responsible if you destroy anything, all apply.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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 #8 - Apr 5th, 2006 at 3:59pm
Print Post Print Post  
Mark's solution is much more elegant than mine, suggest you use his instead..... Grin Grin

I suspect that the argument for his command needs the full path and filename or you will probably default to current working directory.    Hmmm, I wonder if it will accept wildcards for filenames?  And how about /s switch to recurse through subfolders also.....

And maybe add ........ and ....... and this..... too!  Roll Eyes

Thanks Mark!
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: File Duplication Utility
Reply #9 - Apr 5th, 2006 at 5:03pm
Print Post Print Post  
Quote:
Mark's solution is much more elegant than mine, suggest you use his instead..... Grin Grin

A little clever design, and I imagine that someone could turn Sesame into a pretty slick download manager for such things.
Quote:
I suspect that the argument for his command needs the full path and filename or you will probably default to current working directory.

Yup. But if you put the path to the utiliity in your command path, then you can easily run it from where ever you are in the file system.
Quote:
Hmmm, I wonder if it will accept wildcards for filenames?

Nope.
Quote:
And how about /s switch to recurse through subfolders also.....

And maybe add ........ and ....... and this..... too!  Roll Eyes

Thanks Mark!


Anytime someone wants to start paying me to write free utilities... But then, 2.0 will have to wait...
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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 #10 - Apr 5th, 2006 at 6:05pm
Print Post Print Post  
This looks great, Mark, thanks!

Quote:
Hmmm, I wonder if it will accept wildcards for filenames?

Nope.

What if I used it in a batch file?
  

**
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 #11 - Apr 5th, 2006 at 6:07pm
Print Post Print Post  
Quote:
You can do this with Sesame! 

No, really. The File I/O routines can do this. You can get your list of files, delete each file on the list, then write a new file of the same name with no content (or the content of your choice, like the date deleted or how you liked the program).

This sounds promising.  Can you point me to a Guide page number that will get me started?
  

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


The One & The Only

Posts: 2483
Joined: Aug 20th, 2003
Re: File Duplication Utility
Reply #12 - Apr 5th, 2006 at 6:12pm
Print Post Print Post  
Quote:
This sounds promising.  Can you point me to a Guide page number that will get me started?


Pages 125-133 of the Sesame 1.1 Programming Guide.

-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 #13 - Apr 5th, 2006 at 6:17pm
Print Post Print Post  
Thanks Ray, I took a look.  Yikes, those are way too advanced for me right now.  But I've made a mental note.

Thanks again.
  

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


The One & The Only

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

Not that advanced at all. Below is a basic one. It will clear files that you give it until you pass it the word 'done' or nothing.

Code
Select All
Var vName as String
Var vHandle as Int
Var vQuit as Int

vQuit = 0

While (vQuit = 0)
{
	vName = @QuestionUser("Insert complete file path to file to be cleared", "")
	If ((vName = "Done") or (vName = "")) Then
	{
		vQuit = 1
	}
	Else
	{
		If FileExists(vName) Then
		{
			FileDelete(vName)
			vHandle = FileOpen(vName)
			FileClose(vHandle)
			@Msg("Cleared File: " + vName)
		}
		Else
		{
			@MsgBox(vName, "File does not exist!", "Please try again")
		}
	}
} 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2483
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: 2483
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