Creating zero byte "dummy" files

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Creating zero byte "dummy" files Fri Mar 15, 2013 10:33 am • by ckboyle
I need help!

What I need is for Hazel to monitor a folder and subfolders, and every time a file is added, I need to copy the "real" file to a separate folder, and for a "dummy" file with a zero byte file size to be created in the old file's place. Sadly, I'm not much of a command line/script expert, so I could really use some help with this.

Suggestions? Thanks!
ckboyle
 
Posts: 4
Joined: Fri Mar 15, 2013 10:26 am

Re: Creating zero byte "dummy" files Fri Mar 15, 2013 12:07 pm • by a_freyer
Why?
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Creating zero byte "dummy" files Fri Mar 15, 2013 12:22 pm • by ckboyle
I need to be able to move the actual files into a different folder for further processing, but the application I am using requires that the folders exist in its own folder system for reference. By creating dummy files, the application can see that the files are present for its own record without requiring two separate copies of each file.
ckboyle
 
Posts: 4
Joined: Fri Mar 15, 2013 10:26 am

Re: Creating zero byte "dummy" files Fri Mar 15, 2013 12:57 pm • by Mr_Noodle
How about creating an alias instead?
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Creating zero byte "dummy" files Fri Mar 15, 2013 1:01 pm • by ckboyle
I thought about that, but once the real file is moved to it's processing folder, it will likely be moved off the system all together, breaking the alias. I wasn't sure if that would be a problem. I'm certainly willing to give it a try though!

Any suggestion on how to best implement this?
ckboyle
 
Posts: 4
Joined: Fri Mar 15, 2013 10:26 am

Re: Creating zero byte "dummy" files Fri Mar 15, 2013 1:51 pm • by Mr_Noodle
You'll have to do some sort of script for this type of thing. Unless someone else comes through with an actual script, you may need to read up on either AppleScript or shell scripting (the former being more accessible to non-programmers).
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Creating zero byte "dummy" files Fri Mar 15, 2013 2:29 pm • by ckboyle
I'm very close to what I want to do, it just seems that the rules are working in the reverse of what I want them. When I setup the rule:

if kind is not folder & kind is not alias then make alias in enclosing folder & move file to folder Queue

Then I am winding up with the alias in the Queue folder and the original files where they started. Is there a way to reverse this so that the alias winds up in the original location and the file ends up in the Queue folder?

If not, I'll have to start my Applescript research.
ckboyle
 
Posts: 4
Joined: Fri Mar 15, 2013 10:26 am

Re: Creating zero byte "dummy" files Mon Mar 18, 2013 2:06 pm • by Mr_Noodle
Move the files to the destination then create an alias back to the original folder?
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support