I hope, anyone here can help me with a problem I'm having. First of all I'm not somebody who posts a question without searching, reading or trying, but even after reading hundreds of posts and trying many many different approaches I still can't figure out how to do it.
What I'm trying to do is backup one or many files that are selected in the lister. My button/shortcut should
create a folder called "! bu" in the current pane, if it doesn't exist yet
copy the highlighted file(s) into that folder
rename the copied file(s) from "file.ext" to "yyyy.MM.dd, HH.mm.ss file.ext", using the creation or modified date. Maybe it's best to rename while copying, but I read that only the current date could be used with COPY
(Bonus) play a sound if the file hast been backuped correctly, and another sound if it failed
(Bonus) Before copying, open the "! bu"-folder in the other pane and scroll down, so that one can see the newly created files
I initially wrote a batch-file to do this. But it is not always working, depending on filenames. So I would like to try within DOpus.
So far I tried:
copy HERE CREATEFOLDER="! bu" WHENEXISTS=skip
copy HERE CREATEFOLDER="! bu" WHENEXISTS=skip AS "{date|yyyy.MM.dd}, {time|HH.mm.ss} .*"
copy HERE CREATEFOLDER="! bu" WHENEXISTS=skip AS "{createddate|yyyy.MM.dd}, {time|HH.mm.ss} .*"
---
copy HERE CREATEFOLDER="! bu" WHENEXISTS=skip
rename PATTERN * TO "{modified|D#yyyy.MM.dd, T#HH.mm.ss} *"
CREATEFOLDER "! bu"
COPY AS *.temp WHENEXISTS=skip
rename PATTERN * TO "{modified|D#yyyy.MM.dd, T#HH.mm.ss} *" WHENEXISTS=skip
CREATEFOLDER "! bu"
COPY AS *.temp WHENEXISTS=skip
RENAME FROM "! bu\{file}" PATTERN "*" TO "{modified|D#yyyy.MM.dd, T#HH.mm.ss} *" WHENEXISTS=skip
CREATEFOLDER "! bu"
COPY AS *.temp WHENEXISTS=skip
RENAME FROM "! bu\{file}" PATTERN "*" TO "! bu\{modified|D#yyyy.MM.dd, T#HH.mm.ss} *" WHENEXISTS=skip
CREATEFOLDER "! bu"
COPY HERE AS *.temp WHENEXISTS=skip
RENAME PATTERN * TO "{modified|D#yyyy.MM.dd, T#HH.mm.ss} *" WHENEXISTS=skip
CREATEFOLDER "! bu"
COPY HERE AS "! bu\temp_*" WHENEXISTS=skip
rename PATTERN "temp_*" TO "! bu\{modified|D#yyyy.MM.dd, T#HH.mm.ss} *" WHENEXISTS=skip
Rename REGEXP PATTERN=".....(.+)" to="\1"
CREATEFOLDER "! bu"
COPY {o} to "! bu"
RENAME FROM "{filepath$}\! bu\{file$}" PATTERN "*" TO "{modified|D#yyyy.MM.dd, T#HH.mm.ss} *" WHENEXISTS=skip
Please don't laugh, I'm not a programmer, I really tried my best
Could anybody help me here? Thanks in advance,
Nina
WOW!!! It works! And you managed to do this in just a few minutes. If I told you, how long it took me to create what I posted above, you probably wouldn't believe me...
Thank you so much! I will play around with it and report back after the "field test".
Can't say this enough, thank you thank you thank you,
Nina
I feel a bit silly having to ask you again, but I was trying to change your script and I'm really struggling to get it to work. I am not someone to cry for help the second I have a problem, I read through countless posts and tried many different things, to no success. If I told you the amount of time I spent on this, you probably wouldn't believe me. As I mentioned before, I'm not a programmer, so again, please don't laugh about my failed attempts you're about to read : (
I was trying to add 2 little changes:
I wanted the path of the backup-location to be opened in a new tab (on the other side), instead of in the current tab (on the other side). However, I could only get it to work either opening the tab on the other side but in the background, or opening it but not jumping to the newly created file. I tried all possible combinations of READAUTO in line 11 from above.
Then I figured that I would like to have a sound - 3 different ones actually - after the backup. One if the backup-file already exists, one after it has been successfully copied, and one if the backup-file has not been copied successfully. So I stumbled through the forum for another eternity and found @ifexists and Play QUIET. After many different versions here is what I ended up with - but it's still not working:
var cmdLine = '@ifexists:' +
'dest' + '\\' + item.modify.Format('D#yyyy.MM.dd, T#HH.mm.ss') + ' ' + item.name + '"' +
' Play QUIET "C:\backup_exists.wav" @ifexists:else Play QUIET "C:\backup_exists.wav"';
I inserted this in line 17. But since this would have only taken care of 1 of the 3 sounds, and wasn't even working, and it already took me forever, I decided to come back here and ask you for help. It would be great if you could point me in the right direction.
"backup-file already exists" would mean, that the file highlighted has already been copied into the backup-folder before, or already exists there. So if I did a backup of a file before, and didn't change the original in the meantime, and was trying to backup it again. Sort of, what WHENEXISTS=skip checks for, if that makes sense
"backup-file has not been copied successfully" would mean that I'm trying to backup the file, but somehow the backup-copy is not in the backup-folder. Basically:
1: Copy "file.ext" to "! bu\2024.01.23, 14.16.49, file.ext"
2: Play a sound if "! bu\2024.01.23, 14.16.49, file.ext" does not exist
woahhh! I would have never... Well, but I guess, you already know that. Looking at my go above
I got really sick over night and will not be able to test it out, got a fever, the shivers and am pretty dizzy. I will get back to you once I'm back to normal. I just wanted to shout out a quick ty already!