I need to write a perl script which has to log in to an FTP server and download all the sub-directories and contents on sub-directories to local machine. The version of Perl on the FTP server is 5.8.8, i can't upgrade it. One method is to create directories on local machine and then copy each file. I was wondering if there is any command to copy a directory and its content. Is it possible to "tar" the directory to save space?
Thanks,
Amit.
There is Net::FTP::Recursive. I haven't tried it but it seems to fit your requirements.
Related
I have a problem with unzipping files. Usually I use a PowerShell script, that I run through SQL Server database (procedure) and it will unzip my files how I want them (database shouldn't be any issue).
Main part of script:
exec '"for %i in ("'+#path+'\*.zip") do "C:\Program Files\7-Zip\7z.exe" x "%i" -o"'+#to+'""'
But for once in a while there is a .zip file that if run through this script will extract files with names of files encoded badly and to prevent that I need to manually open every .zip file and click to extract in 7-zip GUI and that will returns names of files correctly.
This manual way of doing things very, very slow. Because it needs to be done on a server, God forbids if I am on VPN at home. So let's say I have 5 zip files (3 GB), it will take me hours to unzip. If I do it, through server it takes like 2 minutes.
So I just trying to find out how to unzip it with script, what is the difference between my script and manual extraction?
The root-cause is likely to be files that were created with a setup that doesn't match the codepage of your windows environment. Are any of the zip file publicly available? If so, can you provide a link?
To deal with these problem files, you need to know what encoding was used for the filenames. If the 7z gui can handle these files automatically there must be an option to tell it what encoding to use.
Once you know the encoding you can use the -scs option in 7z to decode the filenames correctly.
Modern zip files don't have this issue because they store filenames in UTF-8.
I have uploaded my entire perl directory to google drive, including perl.exe, /lib, perl scripts, and data files.
Is it possible to run perl.exe on perl scripts using the data files, within the google drive?
If so, where can I find out how to do it?
Google drive is a File storge system.
It is not a server that can run any applications.
I have a Dell PC with Win7 64 using what I believe is the latest version of AutoHotKey.
I wrote an Installer App with AutoHotKey to create two directories with a number of sub directories then install an exe program and a number of data files into those directories. The App installs into the existing C:\Program Files and C:\Program Data directories.
The Installer App creates the sub directory C:\Program Files\DSOSort then installs the file DSOSort.exe. The installer App then creates the sub directory C:\Program Data\DSOSort and installs a number of additional sub directories with all the associated text data files.
I used the FileCreateDir and FileInstall instructions in the Installation App to create the directories and install the files.
Everything in the Installer App and in the exe program works as it should except that the exe will not make any changes to the text data files in the newly created C:\Program Data\DSOSort directory. I have to open the directory with Properties and allow Users to Write. Once that is done the exe will change data in the text data files correctly and all is well.
If I change the Installer App to create a directory C:\DSOSort then install all the sub directories and data files in there instead of into C:\Program Data\DSOSort the exe can write to the text file. I do not have to change any permissions with Properties.
I tried using the various copies of the C:\Program Data\DSOSort directory I found in C:\Documents and Settings and also in C:\Users. The exe can read them but no Write.
I only have this problem with newly installed directories and again as I said earlier it can be corrected with Properties.
The exe program was written for people with enough knowledge to run the Installation App but do not understand Properties or making changes to the directories.
I could just leave the data files in a C:\DSOSort directory but would prefer to put them in a C:\Program Data\DSOSort directory.
Is there a way for AutoHotKey to check the user permissions and changing them if necessary before installing the data files?
Is my PC behaving properly? Is it supposed to create directories without allowing Write to the files?
Some of these directories, like "Program Files", require admin privileges to modify. I believe that is why you're experiencing that. Have your app run as an admin and it should be fine. The setting for you EXE can be found in the properties.
The A_IsAdmin built-in variable returns whether the current user has admin rights.
I don't know anything about PERL first of all. I know very limited html. My assignment is to upload a .pl file (provided to me) to my cg-bin dir on my web server, then make the file executable. I had to manually create a cgi-bin dir into my public_html dir. I uploaded the .pl file. How do I make it executable?
chmod a+rx /path/to/your/file.pl
You may want to check out the chmod man page as well. Just type
man chmod
in your terminal.
Manually creating the cgi-bin directory probably isn't going to work. The web server needs to be configured to recognise the directory as well. And we can't help you with that as we don't know which web server you are using.
As others have said, you will need to chmod
Also (depending on webserver, which you haven't tolYou need to put the path to your Perl executable in the first line of your script:
#!/bin/perl
This will be particular to your server though - you'll need to ask your admin or teacher what it should be for you.
I have a zip file in my ftp server. Is there any way to unzip it using NAnt?
Here is a sample code of what I would like to do:
<ftp connection="liveAuditToolConnection" remotedir="/remotedir">
<unzip zipfile="backup.zip"/>
</ftp>
Suppose that the backup.zip file already exists in the ftp server.
thanx:)
NAnt does not support remote operations. If you are running on a Windows system, trying looking at PSExec