Jump to content
xisto Community
kanade

How To Copy File & Folders From Linux To Windows?.

Recommended Posts

samba from command promptHow To Copy File & Folders From Linux To Windows?.

how can I run samba from command prompt.  each time I do it says CMD does not support UNC path as current directories.

-question by Ankit

 

Share this post


Link to post
Share on other sites

But sometimes when I copy some file or folder from USB to windows drive using ubuntu.Then sometimes I am able to find that file in both operating systems.

By any chance you're working with system files or hidden files. If hidden files are set to not viewable i winodws then not matter which file is that will not be viewable. Also some system files can't be copied or edited so that could be one more reason. As far as i know, this could be the reason for not able to copy or view the files in USB drive.

Share this post


Link to post
Share on other sites

you talking about on same computer or different?if same, i use a flash drive, or for some of the larger files, ill use my external hard-drive. another method is to use an online backup service to "backup" the file, then download from the other partition. directly mounting and copying files is also available, as linux has support for ntfs partitions without any extra programs. on windows you will have to install another program, something along thif different, i usually prefer transferring directly, so i transfer files over ftp, sometimes also over online backup services such as dropbox. this is basically the same as the methods used if the operating systems are on the same machine, but without the direct mounting and copying and adding the method of ftp.good luck with things!

Share this post


Link to post
Share on other sites

Many face problem while transfering file from Linux to windows and Vise versa.
My solution for this is "winscp405". Winscp is a windows freeware tool used to copy file from & to Linux machine.

To get this tool just google for " winscp405" tool and download this small package and install.

Enjoy working with Linux and windows :P

I like it to copy files with Winscp from Windows to a different PC that run Linux with a ssh-server.
Additional i use Putty to login and to telecontrol some Linux-PCs.

But there is a little different between text-files that comes from Windows and text-files that comes from Linux.
If we save a text-file with Notepad, then it contains "carriage return"-bytes at the end of every line.
A text-file saved with a Linux editor contains only "linefeed"-bytes.

For to remove "carriage return"-bytes from a text-file on a Linux-PC i use this script:
#!/bin/sh for i in `find -type f`; do tr -d '\r' <$i >/tmp/trtmp && mv /tmp/trtmp
Additional i have written a little aplications for to run under DOS/Windows for to remove "carriage return"-bytes from smaller text-files(<64KB).
;  Sourcecode for MASM 5   .MODEL SMALL.386  CODE SEGMENT use16 'CODE' assume cs:CODE,ds:DATEN,ss:STAPEL org 100hSTART: mov	  ax, DATEN		  mov	  ds, ax		  mov	  bx, ss		   ; zunächst die beiden Segmentadressen		  mov	  ax, es		   ; voneinander abziehen. Das ergibt die		  sub	  bx, ax		   ; Anzahl der Paragraphen vom PSP bis									; zum Anfang des Stack		  mov	  ax, sp		   ; da sich der Stackpointer am Ende des		  add	  ax, 0Fh		  ; Stacksegments befindet, gibt sein		  shr	  ax, 4			; Inhalt die Länge des Stacks an		  add	  bx, ax		   ; zur bisherigen Länge hinzuaddieren		  mov	  ah, 4Ah		  ; neue GrĂśĂe an das DOS Ăźbergeben		  int	21h		  mov	  bx, 1000h		; 64 KB anfordern/reservieren		  mov	  ah, 48h		  ; anfordern/reservieren:  BX = Anzahl/16		  int	21h		  jc  NOSPACE			   ; keine 64 KB		= Fehler !		  mov	  [FILSEG], ax	   ; Segment des File's		  mov	  fs, ax;----------------------------------------------------------------------------		  mov	  ah, 62h		  ; Segment des PSP's ermitteln		  int	21h		  mov	  ds, bx		   ; PSP-Segment nach DS		  mov	  es, bx		  mov	  di, 80h		  ; Länge Kommandozeile		  mov	  cl, [di]		 ; nach CL		  cmp	  cl, 2		  jna NOPARA		  cld					   ; aufwärts zählen		  inc	  di		  mov	  al, 20h		  repe scasb				; erste Leerzeichen Ăźberspringen		  dec	  di			   ; ein zurĂźck		  mov	  bp, diSUCHCR:   cmp	 BYTE PTR[di], 0Dh		  jz  short FOUND		  inc	  di		  jmp SUCHCR;------------------------------------FOUND:	mov	 WORD PTR[di], 2400h; hinter filenamen: 0,"$"		  mov	  ax, fs		  mov	  cx, es		  mov	  fs, cx		  mov	  es, ax;----------------------------------------------------------------------------		  mov	  dx, bp		   ; Zeiger auf 1.ASCII		  mov	  ax, 3D02h		; Datei Ăśffnen: lesen/schreiben   (OPEN)		  int	21h		  jc  NOFILE				; File nicht gefunden = Fehler !		  mov	  bx, ax		  mov	  ax, DATEN		  mov	  ds, ax		  xor	  dx, dx		   ;  low  auf Anfang stellen		  xor	  cx, cx		   ;  high auf Anfang stellen		  mov	  ax, 4202h		; Länge holen: vom Ende		  (LSEEK)		  int	21h		  and	  dx, dx		   ;  High-word = null ?		  jnz TOBIG				 ; nein zurĂźck		  mov	  [FILEN], ax		; Anzahl retten		  mov	  dx, 1			; low	holen		  xor	  cx, cx		   ; high   holen		  mov	  ax, 4200h		; Zeiger positionieren: vom Anfang(LSEEK)		  int	21h				;   nochmal wegen DOS-Fehler		  xor	  dx, dx		   ; low	holen		  xor	  cx, cx		   ; high   holen		  mov	  ax, 4200h		; Zeiger positionieren: vom Anfang(LSEEK)		  int	21h		  mov	  cx, [FILEN]	 ; Anzahl zu ladender Byte's		  mov	  ds, [FILSEG]		  mov	  ah, 3Fh		  ; Datei lesen u. Zeiger bewegen   (READ)		  int	21h		  mov	  cx, ax		  mov	  ah, 3Eh		  ; Datei schlieĂen				(CLOSE)		  int	21h;----------------------------------------------------------------------------		  mov	  ax, DATEN		  mov	  ds, ax		  xor	   si, si		  mov	 [FILEN], cxSUCHE:	cmp	  si, cx		   ;  Ende des File erreicht ?		  ja  short ZMA		  cmp	 BYTE PTR es:[si], 0Dh		  jz  short SCHR		  inc	  si		  jmp  short SUCHE;------------------------------------SCHR:	 dec	 WORD PTR[FILEN]		  sub	  cx, si		  mov	  di, si		  inc	  si		  mov	  ds, [FILSEG]		  dec	  cx		  mov	  dx, si		  rep movsb		  mov	  ax, DATEN		  mov	  ds, ax		  mov	  si, dx		  mov	  cx, [FILEN]		  jmp  short SUCHE;----------------------------------------------------------------------------ZMA:	  mov	  ax, fs		  mov	  dx, 82h		  xor	  cx, cx		  mov	  ds, ax		  mov	  ah, 3Ch		  ;  Datei erstellen (CREATE)		  int	21h		  mov	  bx, ax		  mov	  ax, DATEN		  mov	  ds, ax		  xor	  dx, dx		  mov	  cx, [FILEN]		  mov	  ds, [FILSEG]		  mov	  ah, 40h		  ;  Datei beschreiben			 (WRITE)		  int	21h;----------------------------------------------------------------------------NBACK:	mov	  ah, 3Eh		  ; Datei schlieĂen				(CLOSE)		  int	21hBACKE:	mov	  ax, 4C00h		  int	21h;--------------------------------------------------------------------------- NOSPACE:  mov	  dx, OFFSET ERRTEXT		  mov	  ah, 9		  int	21h		  jmp  short BACKE;------------------------------------NOPARA:   mov	  ax, DATEN		  mov	  ds, ax		  mov	  dx, OFFSET PARERR		  mov	  ah, 9		  int	21h		  jmp  short BACKE;------------------------------------NOFILE:   mov	  ax, DATEN		  mov	  ds, ax		  mov	  dx, OFFSET FILERR		  mov	  ah, 9		  int	21h		  mov	  ax, fs		  mov	  ds, ax		  mov	  dx, bp		  mov	  ah, 9		  int	21h		  jmp  short BACKE;------------------------------------TOBIG:	mov	  dx, OFFSET BIGERR		  mov	  ah, 9		  int	21h		  jmp  short NBACK  CODE ends;---------------------------------------------------------------------------   DATEN SEGMENT use32 'DATA'FILSEG	DW 0FFFFh				 ; Segment des File`sFILEN	 DW 0FFFFh				 ; Anzahl der geladenen Byte`sFILERR	DB 0Dh, 0Ah		  DB "FEHLER ! File auf (angegebenen) Laufwerk/Pfad nicht gefunden = $"PARERR	DB 0Dh, 0Ah		  DB "FEHLER ! Kein Filename als Parameter angehängt/Ăźbergeben !$"ERRTEXT   DB 0Dh, 0Ah		  DB "FEHLER ! Zu wenig Arbeits-Speicher vorhanden !"		  DB 0Dh, 0Ah, 0Dh, 0Ah		  DB "Das Programm benĂśtigt zur AusfĂźhrung, ca. 64 KB freien Arbeits-Speicher !"		  DB "$"BIGERR	DB 0Dh, 0Ah		  DB "FEHLER ! File ist grĂśĂer als 64KB !$"  DATEN ends;---------------------------------------------------------------------------   STAPEL SEGMENT use16 STACK 'STACK'	   DB 20h dup (0FFh)  STAPEL ends;---------------------------------------------------------------------------  end
Dirk

Share this post


Link to post
Share on other sites

for i in `find -type f`; do tr -d '\r' <$i >/tmp/trtmp && mv /tmp/trtmp

Hi, Dirk,
I would like to know if I am slightly tired today, or if there is a small mistake in your script. I feel something being missing in your "mv" syntax.
I would have said :
mv /tmp/trtmp $i
Else, I would not see how the changes could be permanently written to the concerned text file.
Regards
Yordan

Share this post


Link to post
Share on other sites

Hi yordan,

Hi, Dirk,

I would like to know if I am slightly tired today, or if there is a small mistake in your script. I feel something being missing in your "mv" syntax.

I would have said :

mv /tmp/trtmp $i
Else, I would not see how the changes could be permanently written to the concerned text file.

Regards

Yordan

Personaly i am not realy familar with Linux, so i became i little help from my nephews. He send me this example for to remove all CRs in textfiles.

I guess the red marked redirection command here("<$i >/tmp/trtmp && mv /tmp/trtmp") include also the filename for the mv-command?

 

Dirk

Share this post


Link to post
Share on other sites

I guess the red marked redirection command here("<$i >/tmp/trtmp && mv /tmp/trtmp") include also the filename for the mv-command?

No, the ">/tmp/trtmp" redirects the editing "sed" command to the single file named /tmp/trtmp, and the "mv /tmp/trtmp" will probably raise a syntax error, probably something like :

Usage: mv [-I] [-i | -f] [-E{force|ignore|warn}] [--] src target

or: mv [-I] [-i | -f] [-E{force|ignore|warn}] [--] src1 ... srcN directory

Regards

Yordan

Share this post


Link to post
Share on other sites

No, the ">/tmp/trtmp" redirects the editing "sed" command to the single file named /tmp/trtmp, and the "mv /tmp/trtmp" will probably raise a syntax error, probably something like :

 

Regards

Yordan

Hm, then i think my file is corrupted and another copy of that file also.

The next days i try to contact my nephews for to clear this. Many thanks for your feedback.

 

Dirk

Share this post


Link to post
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

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.