Jump to content
Ketarin forum

Trouble with copying files


Steiner
 Share

Recommended Posts

Hi,
As the the title says, I have some issues with the copy command.
Some files I want to download are provided in archives. What I want to do is, to extract them
,then copy the executables inside the extracted folders to another place and delete the folder, I've tried it with this script:

"..\Universal Extractor\UniExtract.exe" "..\{file}" ""
copy "..\rsload.net.Asymptote.{version}\*.exe" "..\"
rd "..\rsload.net.Asymptote.{version}" /s /q
 

It extracts the archive just fine, but it only copies the file, when I run it a second time and it doesn't delete the folder at all.
Any idea, what I'm doing wrong?

Thanks for the help.

Link to comment
Share on other sites

Hi,

 

I don't think ..\ will work. As far as i remember ..\ is the main drive directory of the drive on which Ketarin was installed.

Have you checked the console output?

 

You can also try to extract your files into a temp folder and delete that folder after extraction.

 

Example:

7z x "{file}" -o"{file:directory}\temp\" -y
COPY /B "{file:directory}\temp\asy.exe" "{file:directory}\"
RD /S /Q "{file:directory}\temp"
Link to comment
Share on other sites

..\ works fine, but only when I run the script a second time, the archive has to be extracted beforehand, otherwise the copy-command does not work.
Is there some sort of wait-command I could use there?

Du kommst aus Deutschland, vielleicht kann ich mich auf Deutsch besser ausdrücken:
Wenn ich das Skript zum ersten Mal ausführe, entpackt er den Ordner, kopiert aber nicht die angegebene Datei und löscht auch den Ordner nicht. Wenn ich das Skript dann nochmal ausführe, wird die Datei in den Hauptordner kopiert. Aber das sollte natürlich in einem Durchlauf passieren.

Link to comment
Share on other sites

Wouldn't it just be easier to extract the individual file directly to where you want it to be stored?

 

 

7z e -y -o"..\" "{file}" "rsload.net.Asymptote.{version}\asymptote-{version}-setup.exe"

 

Though, to be fair, the whole copying-the-file "up" a directory problem doesn't really exist if you extract only the one file, so you could do this instead to extract it directly to the location you really want it:

 

 

7z e -y -o"{file:directory}\" "{file}" "rsload.net.Asymptote.{version}\asymptote-{version}-setup.exe"
Link to comment
Share on other sites

Ok, I figured it out. I needed to prepend   start "" /wait    before calling universalextractor, so now my script looks like this:

start "" /wait "..\Universal Extractor\UniExtract.exe" "..\{file}" ""
copy "..\rsload.net.Asymptote.{version}\*.exe" "..\"
rd "..\rsload.net.Asymptote.{version}" /s /q

 

and everything works fine.
But thanks for you help, I didn't know you can extract specific files only, this seems to be the more elegant way, I'll try that.
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.