1.

Solve : Help : FTP - Case Sensitive?

Answer»

We're on UNIX. Does anyone know if there's an option or command to set to make the mget or mput not case sensitive.

We're pulling in a file that is sometime submited in upper case and sometime lower case. I just don't want to hardcode it in the ftp script.

Thanks.I tried case but it doesn't do what you want

Code: [Select]ftp> case
Case mapping on.
ftp> get fred
200 PORT command successful.
550 fred: No such file or directory.
ftp> get FRED
200 PORT command successful.
150 OPENING BINARY mode data connection for FRED (3 bytes).
226 Transfer complete.
local: fred remote: FRED
3 bytes received in 0.0017 seconds (1.70 Kbytes/s)
Sorry :-?I tried that too at first, but there's got to be a simple solution.

Thanks though.Any chance of logging in to the host which has the files?

You could run a cron job every few minutes which uses mv and tr to rename the files to lowercase.

Code: [Select]cd /source-dir
for file in *
do
mv "$file" "`echo $file | tr '[A-Z]' '[a-z]'`"
done
or can you rsh/ssh into the host to run this script before STARTING the ftp?one way you could do
1) log in to FTP server, list out the directory
2) compare the directory list to a predefined list of the filenames you want to get, but use lowercase or uppercase in all comparison
3) if they match, get the fileCurrently we have a service that runs on that server that renames those files, but we're trying to get from it because on occasion it causes a problem.

We PROBABLY will have to hardcode the script to look for lower and upper case.

Thanks for all your suggestions.Your problem is that the file is being erratically named - that's what you need to fix. As you know, under *nix "Thisfile" is a completely different file from "ThIsFiLe". Case sensitivity is intended and ignoring it can create risky problems.

As for your immediate problem, why not mget all the different case alternatives? Use whatever wildcard/regex system your FTP client supports.



Discussion

No Comment Found