Create empty file from existing file

I need to "mirror" a few hundred files, but the mirrors should be empty files. Only the file name should match.

How could I create a new empty file in the destination lister to match every selected file in the source lister?

Make a button which runs this command:

Copy FILE=NUL AS {file$}

Note for people from the future: The FILE=NUL trick won't work in Opus 10, but it works for now in Opus 9.

Hmm...

I didn't realise we had people from the future using this site. Maybe we should let the X-Files folk know about this. :smiley:

Note for those future people once Opus 10 is released... :slight_smile:

I imagine the following method should still work:

<?xml version="1.0"?> <button display="both" icon_size="large" label_pos="right"> <label>Copy as zero-byte file</label> <tip>Copy as zero-byte file</tip> <icon1>#copy</icon1> <function type="batch"> <instruction>@runmode hide</instruction> <instruction>@filesonly </instruction> <instruction>@nofilenamequoting </instruction> <instruction>type NUL &gt; &quot;{d}{o}&quot;</instruction> </function> </button>
Note: neither this general method, nor the method Leo suggested will copy into folders... both would create a FILE named for the selected folder name. So this means this will only work against currently selected files... If you need to recurse through directories, there's not much I think you can do to get OPUS to do this, you might be best served by doing it all through a script of some kind.

Yeah, the DOS type method will still work in Opus 10. Only problem with it is it'll go wrong if the file has a % in its name.

Since this keeps coming up, maybe Opus should just get an explicit way to create empty files in any location. e.g. The Filetype NEW command could have a destination path argument so it isn't restricted to creating new files in the current directory.