Why can't I acces my NAS drive with rclone? - command-line

I am trying to access my NAS drive with rclone:
rclone check C:\Some_local_folder "N:\"
where N:\ is my NAS drive. However, I can't seem to access my NAS in this way:
2020-06-18 20:24:25 ERROR : file.jpg: File not in Local file system at //?/N:/
However, in the same command line window, I can access my NAS with ls N:\ for example. How can I access my NAS with rclone?

You are running "rclone check". That will not make chances to local or remote. It will only check if local and remote are the same. Looks like a file that is present on local is not found at remote.
So you are accessing your NAS.
The notation you are seeing is a consequence of the UNC expansion:
Long paths on Windows
Rclone handles long paths automatically, by converting all paths to long UNC paths which allows paths up to 32,767 characters.
This is why you will see that your paths, for instance c:\files is converted to the UNC path \?\c:\files in the output, and \server\share is converted to \?\UNC\server\share. (https://rclone.org/local/#long-paths-on-windows)

Related

Zip files with encryption in a remote share, keeping orignal names and location

My team faces the need to encrypt all files in a repository with AES256. For this purpose, we decided we are going to zip all files with such encryption, using the same key for all of them.
The problem we have is that these files sit in a NAS, so from windows boxes they are accessible by \ to them.
The directory structure is something like this:
Original Structure:
Root
-1
|--folder1
|---file1.ext
|---file2.ext
|--folder2
|---filea.ext
|---fileb.ext
|--folder2.a
|---filec.ext
and so on...
Essentially, what we need is to have all the original files contained in a zip file, keeping their original names, which would be something like this:
Desired Outcome:
|-Root
|-1
|--folder1
|---file1.zip
|---file2.zip
|--folder2
|---filea.zip
|---fileb.zip
|--folder2a
|---filec.zip
and so on...
To accomplish this, we tried a batch script that calls 7zip, but it only works if it's run from the root directory, which is something we cannot use as the files are not in a server.
Here is the syntax of the batch script we came up with:
FOR /R %%i IN ("*.wmv") DO "C:\Program Files\7-Zip\7z.exe" a -mx0 -tzip -pPasswordHere "%%~dpni.zip" "%%i"
But, as wrote previously, it only works when run from the root folder, which is something we cannot do as files sit on a network location.
Mapping the drive or making a symbolic link to it doesn't do the trick either.
I've also checked on 7zip to do this, namely, making use of its "-r" operator, but I couldn't find a way to get the desired outcome (namely, recurse through all folders in the remote tree structure -there are a lot of them...- and keep the original file name).
I'm open to any suggestions as any kind of script, trick or guizmo that gets the job done will be more than welcome. =)
Thanks a million in advance!,
Sebas.
----SOLUTION----
I actually found a sollution here, mapping the drive in a different way (it's so simple it just made me feel stupid(er), but it's altogheter beautiful).
Using the batch script below, the remote share can be mapped like so:
You can map a drive using
net use X: \\server\directory
and then you can change to that directory using
pushd X:
(Post from which the answer was taken from: Batch File Iterating through files on a local network server)

Copying large files using Remote Desktop

I have a 4 GB text file, compressed to 1.4 GB zip file. I need to copy it over to a Windows secure server using RDP. I am able to copy small files but not this file. It takes 15 mins and then shows an error. Any tips?
You can try to copy it by using Drive Redirection. Here's a tutorial.
BTW, RDP cannot copy files larger than 2GB by using clipboard as said in Microsoft support
window rdp clipboard has limit of about 2GB if you want to copy paste more than 2 gb file then you can try any of these options.
split file into parts like 1 gb each part with help of winrar or any other software
Use any FTP software
map local pc drive for remote desktop session(for move or copy data)
File size doesn't matter - I copied folders through Remote Desktop connection with 30GB and more. While doing this I received "Unspecified error". The Problem is that you aren't allowed to use the clipboard again while you are copying. Doesn't matter if you use the clipboard for the same machine or from the remote machine. To summarize don't use Ctrl+C.
The madness is the error is delayed so you don't recognize quickly that those things relate.
format usb drive as ntfs
connect drive as local resource in remote desktop
NET USE X: \\TSCLIENT\F
robocopy c:\source x:\
net use X: /delete
If you are administrator, you can copy the files of any size over the network using Administrative Shares assuming that it is not purposefully disabled.
Enter the following url on your File Explorer and you will see all the files and folders on your C drive of that computer with read and write access:
\\computername\c$
right-click zip-file >> Properties >> Advanced >> Encrypt contents
open your one-drive or googledrive (if the secure server allows you) and park the encrypted file on there.
(you might have to one-drive space by signing up to a months 365)
https://support.microsoft.com/en-us/office/manage-your-onedrive-storage-and-limits-989fce19-ade6-4e2f-81fb-941eabefee28
I guess it would might be possible to use google datastore or something cloudy.

How to navigate to a server through Windows command line

I'm writing a batch file and have to navigate to a server first. However if it is only a drive I know I can just type in
C:\> D:
D:\>
or
C:\> cd blar
D:\blar\>
But now the target location is like: \\10.0.0.0
So how can I navigate to it without mapping it to drive D first?
You can refer to the resources in your server as
\\10.0.0.0\shareName\blar\doSomething.cmd
But if you want to "navigate" to the required point, you need to map to a drive letter.
And here, you have the option to explicitly use net use to create the mapping or you can do
pushd \\10.0.0.0\share\blar
doSomething.cmd
popd
that will assign a drive letter to the share and change the current directory to the indicated folder in the mapped drive. Popd will revert the operation, leaving you in the starting point

After Robocopy, the copied Directory and Files are not visible on the destination Drive

I've been happily using robocopy for backing up my computers to an external usb drive. It's great since it only copies the files that were changed/updated/new. I can take my external drive to any machine and look at it just as if it's another drive on the computer.
I've recently purchased a 750g and another 1tb external hard drives. I ran a robocopy over the weekend that copied about 500g to my external drive. After the copy My Computer shows that ~500g has been used on the external drive. The strange thing is that when I click on the drive in Windows Explorer, nothing shows up in the right pane of Windows Explorer (and the + goes away in the left pane). I copied a single file (drag-and-drop) to this drive and it shows up in Windows Explorer. Command Prompt show the same thing. 1 file.
I know the files are on the drive as it shows up as the Free Space has been reduced.
I read that I should make sure simple file sharing is off, which it is. I also took ownership of the files as Administrator. Still nothing. It works the same on my WIndows XP machine and my Windows 7 Ultimate.
Has anyone else seen this? Or even better, does anyone know what I am doing wrong or how to solve this problem?
thanks!
Bill44077
In my case, the above didn't work.
This worked instead: attrib -h -s -a [ Drive : ][ Path ].
For example: attrib -h -s -a "C:\My hidden folder".
When copying from the root directory of a drive to a folder (non-root directory on a different drive), this can happen.
RoboCopy may set the new directory to hidden, as it copies the system attribute of the root folder of the drive over to the new folder.
You can prevent the new directory from becoming hidden by adding the /A-:SH option/flag/switch to your robocopy command.
See this Server Fault Answer to "Why does RoboCopy create a hidden system folder?
" for more information.
However, this may or may not prevent copying system attributes in other folders, according to this discussion on the Microsoft forum "ROBOCOPY hides destination Directory".
Here is an example taken from my longer, more thorough, Answer on Super User to the Question "How to preserve file attributes when one copies files in Windows?":
Robocopy D:\ C:\D_backup /A-:SH /DCOPY:T /COPYALL /E /R:0 /ZB /ETA /TEE /V /FP /XD D:\$RECYCLE.BIN /XD "D:\System Volume Information" /LOG:C:\D_backup_robocopy.LOG /MIR
However, if you already copied the directory without the /A-:SH option, running the command mentioned by Ricky above (attrib -h -s -a [ Drive : ][ Path ]) will fix the issue by unhiding the directory. Though, I found that -a was not needed.
So in my case, for the example above, attrib -h -s C:\D_backup (without the -a option) made D_backup visible.
Just ran into this issue myself, so it may be a late response and you may have worked it out already, but for those stumbling on this page here's my solution...
The problem is that for whatever reason, Robocopy has marked the directory with the System Attribute of hidden, making it invisible in the directory structure, unless you enable the viewing of system files.
The easiest way to resolve this is through the command line.
Open a command prompt and change the focus to the drive in question (e.g. x:)
Then use the command dir /A:S to display all directories with the System attribute set.
Locate your directory name and then enter the command ATTRIB -R -S x:\MyBackup /S /D where x:\ is the drive letter and MyBackup is your directory name.
The /S re-curses subfolders and /D processes folders as well.
This should clear the Read Only and System attributes on all directories and files, allowing you to view the directory normally.
In addition to the great answers SherylHohman and Ricky left I wanted to add that merely adding the /A-:SH switch for robocopy did not work and the copy created a hidden, system folder on the destination drive.
However, using the /A-:SHA parameter did work and my top level destination directory was not given the system or hidden attributes. Weirdly, my drive does not have the "a" (archived) attribute set so I am dumbfounded as to why this works at all. I do prefer simply removing these attributes to only the root destination folder after completion of the robocopy command per Ricky's suggestion so that these attributes are respected for any sub-directories. Though the /A- switch is easier to manage and (for my backup purposes) are not relevant to any directories I am backing up. You may want to consider not removing the system or hidden attributes if you're backing up your C:\ drive though.
You could try this, I say could, because the whole Windows 10 has annoying flaws everywhere, I have lost trust to Windows 10 and Microsoft.
Well I found that after I robocopied the whole Documents-folder to a root of external drive, I got a folder that is not named Documents but the Documents-folder is renamed&translated to my native language, so it could be some Language issue. (the /XD option tells robocopy to skip a folder)
C:\users\asdf\documents >robocopy . f:\ManuBackup /XD c:\Users\Asdf\Documents\OneDrive /s
File Explorer shows Tiedostot-name (=Documents in finnish) and Command Prompt shows ManuBackup-name. Also I have tried all attrib.exe commands to the ManuBackup-folder, don't trust me 100%

Shadow copy to clone system volume on Windows XP

I am looking for a program that uses shadow copy to copy the contents of a Windows XP system volume that is running.
I.e. I want to clone the system volume with the following snags:
(1) I want to be able to select which files to copy (i.e. not the entire file system)
(2) This is probably implied by (1), but I also have to avoid sector-by-sector copies
(3) I do not want to clone a file system into an image file and restore to a 3rd drive but want to do a filesystem to filesystem copy
All the backup/clone utilities I looked into stumble on one of above points. Any ideas?
Perhaps this one: Hobocopy