I want to know what is the default mode used (ASCII or binary like FTP) while transferring files using SCP.
Is there any file mode concept in SCP ? How does it work ?
The file transfer modes in FTP are used to solve the problem of different operating systems having different line endings. The idea is that if a text file is transferred from a Unix machine to a Windows machine, the line endings must fixed, meaning that LF must be replaced by CR LF everywhere in the file. The reverse operation must be done when transferring the file in the other direction.
However, if you're transferring binary files, you want to leave the file as-is, because any LFs in the binary file are not actually line endings. Therefore, FTP introduced ASCII mode and Binary mode.
This is still a problematic solution, especially because the default mode is ASCII mode, so if you forgot to switch modes you might mangle your binary files and they won't work. The different modes are considered to cause more trouble than the problem they solve.
And so, SCP simply does not provide this feature, and always leaves the files as is. Fixing line endings is left to the user using tools like dos2unix and unix2dos.
In essence, all files are transferred in "binary" mode, meaning that line endings are never changed.
According to my knowledge there is no mode for scp.
See this man page for more details
I want to know what is the default mode used (ASCII or binary like FTP) while transferring files using SCP.
Unfortunately, in my experience, it depends a bit on the implementation of scp on the OS you are running on. For example, although linux scp doesn't seem to do make any changes to the files -- i.e. EOL characters are not converted between Windows and linux, this is not true under z/OS (sic). On the IBM mainframe, all files being scp-ed seem to be converted from ASCII to EBCDIC character encoding by the scp application itself.
However, it looks like sftp by default does not do the character converting so files come over in their native ASCII.
Related
I built a quite large PDF using LaTeX with the lualatex compiler (I need that one because of specific fonts) and now want to shrink the PDF with ps2pdf, following this instruction (the answer with the second-most votes, since gs is not recognized as a command line tool on my computer). My command looks like this:
ps2pdf -dPDFSETTINGS=/ebook -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -q -sOutputFile=output.pdf input.pdf
I get this error message:
MiKTeX GPL Ghostscript 9.25: Device 'pdfwrite' requires an output file but no file was specified.
**** Unable to open the initial device, quitting.
I definitely made sure that the file exists, I tried it using as *.ps file as input, gave the full path, once with and without double-quotes (Windows system), yet nothing worked. Strangely enough, just running ps2pdf ouput.pdf input.ps works, but produces an even larger PDF. What am I missing?
The file that can't be opened is the output file, so if it exists, that would be a potential problem. If 'something else' has the output file open then it won't be possible to write to it.
You appear to be running a non-standard version of Ghostscript, judging by the startup banner, if I were you I would install and use a standard version of Ghostscript, even if you have to build it yourself.
It's odd that 'ps2pdf' which is just a script to run Ghostscript would work, whereas a simple 'gs' would not. I personally would not use the script. Try and find the Ghostscript executable and run that directly.
I'd drop the -q (quiet) switch as well, at least while trying to solve a problem, suppressing messages could be hiding something useful.
Oh I see, you are actually using Windows. Well, the executable on Windows isn't called 'gs', it's called gswin followed by either 32 or 64 for the word size and then c if it's the command line (as opposed to windowed) version. So you want one of gswin32, gswin32c, gswin64 or gswin64c. Note that the Ghostscript installer doesn't add the installation directory to the $PATH environment variable so if you just open a Windows command shell and type 'gswin32c' it won't be found. You need to either add the isntall directory to the $PATH or supply a full path to the executable.
I'd personally use the vanilla Windows binary rather than a modified version supplied under MingW or whatever Linux shell you are using. It's also conceivable that this is causing your problem writing to the output file, if the directory is unavailable, or read-only, to the shell.
I use WinSCP as ftp client and i have the transfer set to binary. I also use Notepad++ as editor.
Hovewer every file i upload, is stripped of all line breaks.
<?php
// this is a comment
echo 'this is an echo';
?>
Gets turned into
<?php // this is a comment echo 'this is an echo'; ?>
Outputting nothing beacause it is interpreted as comment.
Do I have to set something else to upload files without any problem?
With FTP protocol, WinSCP never modifies line endings itself.
So it's either your editor or the FTP server.
Find a local temporary copy of the file you have opened in Notepad++. Open it in a binary viewer/editor and check, if the line-end characters are present.
Check if Ascii/Text or Binary mode is used for the upload. WinSCP defaults to Binary mode. But you may have configured it to use Ascii/Text mode. While this should not remove the line endings, there maybe some issue with FTP server. Forcing (default) Binary mode may help.
Download the edited file using Binary mode and open it in binary editor/viewer and check if the line-end characters are present. Or do binary compare against the local temporary copy. They should be binary identical, if the Binary mode was used for upload.
I don't know is this site a good place to ask this question... A long time ago, my operating system was linux. On linux I made a file with name \/:*?"<>|. Then I installed windows instead of linux, but now I cannot access or delete this file. I tried to delete it using Unlocker, ProceXP, Command Prompt and many other programs, but I couldn't. Also, I tried all commands in Command Prompt which can be used for deleting undeletable files, but this file is still here. If I try to rename it, process explorer.exe crashes. Then I installed linux again and this file become accessable.
Now I have windows and another file with name \/:*?"<>|. Is it possible to access this file without installing linux? Is there a way to access place on filesystem where this file name is stored and manualy change it to any acceptable file name? If yes, can you explain which program is best for it?
Try using DeleteDoctor. I've used it under similar situations as yours with great success. You can download a copy here:
http://www.download25.com/delete-doctor-download.html
I'm trying to create a Worklight project in Worklight Studio 6.1 from a template. It's a straight forward process as described here: http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/index.jsp?topic=%2Fcom.ibm.worklight.dev.doc%2Fstudio_ext_assets%2Fc_wl_project_templates.html
However I'm getting "invalid byte 2 of 2-byte UTF-8 sequence" exceptions on some of the settings.xml files inside the android environment's native resources when trying to compile newly created project.
The files are in utf-8 inside the template and I have utf-8 set up for my workspace file encoding ( Preferences->General->Workspace ).
But after extracting stuff from the template ( which is really a zip bundle ) looks like it changes encoding somehow.
Problem goes away when you try to re-save .xml file (for example - open it, add a char somewhere, delete it and save). But this is not an option since we are going to deliver the template to a customer and this will affect the 'user experience'.
Also, the same exact template works fine on linux platform. I saw this issue on windows.
Has anybody experienced this before and could share any info on how to fix it?
Thank you.
Make sure that under Preferences->General->Workspace in Eclipse, the default text file encoding is set to UTF-8 and not US-ASCII (usually by default it is set to ASCII). This should take care of the encoding problems.
I have am trying to unzip a file via SSH, I require a case sensitive unzip.
My server is using Debian Unzip 6.
It shouldn't be doing this, but it is converting all my file names to lower case, causing my Joomla site to buckle.
There are far too many files to rename manually or to FTP if I want to finish in my lifetime.
I have a zip called bv2.zip placed in the directory I want to extract in...
I have cd'd into my directory and simply issued: unzip bv2.zip .... filenames all go to lowercase...
I have also tried absolute paths to no avail, the UNZIP help and manual states that case sensitivity is enabled by default with this version, but obviously not...
Any ideas??
what does unzip -v file.zip show? The docs say
by default unzip lists and
extracts such filenames exactly as they're stored (excepting
truncation, conversion of unsupported characters, etc.)
It'd be worth checking how they are stored. If the creating zip program is storing them all as lowercase, then that's where you need to look for a way to actually store unaltered filenames.
Finally, just to be sure, check that there's no alias or environment variable on your Debian server forcing use of the -L option. Look at output of the following commands, run on the Debian server's terminal:
alias
(there should be no weird alias for unzip)
echo $UNZIP
(Any flags contained in this environment variable will be used by unzip as if they'd been added to the command invocation).
I was facing same problem in my 1&1 hosting. I have solved it by defining a new alias, by typing:
alias unzip='unzip'
The problem was unzip -L was aliased.
Now I have unzipped prestashop backup and it works like a charm
Regards
Are you sure your .zip file didn't have all lowercase names to begin with? Maybe whatever program you used to create the zip file is converting the names to lowercase.
The "-L" (convert all filenames to lowercase) and "U" (convert all filenames to upper case) options control this behavior:
http://www.mkssoftware.com/docs/man1/unzip.1.asp
This would ONLY be an issue if the files in the .zip were from a case-insensitive filesystem (like MS-DOS or VAX/VMS). It should not be an issue if the files were .zipped up on ANY contemporary filesystem (Unix, MacOS, Windows 95 or higher) with ANY contemporary version of Zip or WinZip.
Soooo ......
Is there any chance these are DOS files?
Or did you use a DOS version of PKZip?
Or were the files simply lower case to begin with?