r copy a folder with subfolders in it - r

Is there a command to copy a folder including all its subfolders with files to other directory? I dont want to create the new directories and then using copy.file to move the files, Id like to make it faster.
location_folder ="path1"
new_location = ="path2"
name_folder="folder"

Related

moving files from a subsubfolder to a folder x10000 times

I have a lot of folders that need organizing that would take weeks to do by hand. I already know that the . trick will work, but then I will lose the already organized file structure. What I need is my main folder (let's call it C:\docs) that has hundreds of subfolders (folder a-j), have even more subfolders within the subfolders (which I am calling subsub folders) I don't want to lose the folder structure of folder a-j, but the folders within those folders need to be emptied to their respective subfolders.
DOCS
folder a
sub folder 1
file 1,2,3,4......
sub folder 2
file 5,6,7,8......
sub folder 3
file 9,10,11,12....
folder b
sub folder 1
file 1,2,3,4......
sub folder 2
file 5,6,7,8......
sub folder 3
file 9,10,11,12....
and so on.
INTO
DOCS
folder a
file 1,2,3,4,5,6,7,8,9,10,11,12......
folder b
file 1,2,3,4,5,6,7,8,9,10,11,12......
and so on.
Any help with this would be great. I can't even get the language right to google search my problem, because all I get is the - . trick, which again is fine but would take actual weeks to do with the number of folders that need this. Thanks in advance!
What I would do is to copy the structure with ROBOCOPY.EXE tool and save it somewhere like C:\Backup\
I would run a command DOS like this:
robocopy c:\docs*.* c:\backup\ /CREATE
This will copy only the structure of subdirectories.
type in a DOS box:
robocopy /?
to get all options

How to put files in a folder and generate .zip file?

I want to generate a .zip file which contains some files and folders. The file inside the folder might be contained in some other paths and I want to put files in another folder and generate a .zip file from them.
By other words, I don't want to physically generate the folder with files. The files might be on some roots and I want to generate folder virtually to put them on the .zip file.
Imports System.IO.Compression
ZipFile.CreateFromDirectory("source","destination.zip",CompressionLevel.Optimal,False)
As an example if I have these files on my website:
- ~/files/image/1.jpg
- ~/files/pdf/2.pdf
- ~/intro.docx
I want to put them on a zip which when I extract it, the files will be as follows:
- ~/files/1.jpg
- ~/files/2.pdf
- ~/intro.docx
For the source put the root folder and it will do it
example :
This is yours
- ~/files/image/1.jpg
- ~/files/pdf/2.pdf
- ~/intro.docx
But before this there is a root folder whic is the ~ just simpily put as a source

Copying and pasting specific files from one existing directory to another existing directory

Hi I am new to R and been trying to create a script that copies a few specific files from one location to another location. Both directories already exist.
#identify the folders
current.folder <-'S:\xx'
new.folder <-'S:\yy'
filestocopy<-c("a.xlsx",'b.xlsx','c.xlsm')
#copy the files
file.copy(filestocopy,new.folder)

Use Robocopy to copy files from source that have changed or are new when compared to a specified folder to a 3rd folder

I have a large folder of files that needs to be transferred to a remote site. This folder is currently 10GB total, but contains lots of much smaller files.
Rather than copying the entire 10GB each time, we'd like to massively reduce the data transfer size to be only the files that are new or changed. We plan to do this like so:
SOURCE_DIR is the folder that has all the files and is up-to-date.
COMPARE_DIR is a directory "clone" of the folder at the remote end. It is basically all the files up to the last time files were transferred.
TRANSFER_DIR is an empty folder that (we hope) ROBOCOPY can place files that are new or changed in SOURCE_DIR when compared with COMPARE_DIR into.
An example:
SOURCE_DIR has 4 files: 1.txt, 2.txt, 3.txt, 4.txt
COMPARE_DIR has 3 of those files: 1.txt, 2.txt, 3.txt
The ROBOCOPY command would compare SOURCE_DIR with COMPARE_DIR and see that 4.txt isn't in COMPARE_DIR so copies it into TRANSFER_DIR
TRANSFER_DIR then only has 4.txt file in it which we can copy up to the remote end and place in the folder making it the same as our SOURCE_DIR this end.
This can be done with rsync using the --compare-dest=DIR argument, but as this is Windows, I'd rather not have to install rsync unless I need to.

How to create a empty folder with QuaZIP

I've successfully created folders and files inside a ZIP file with QuaZIP, but to create a folder i used a not elegant way, that creates a file without name inside the ZIP file. Is there any way to create empty folders inside a ZIP file without create a file inside that folder?
Code to create folder:
QuaZip zip("path_to\\zipFile.zip");
zip.open(QuaZip::mdCreate);
QuaZipFile outFile(&zip);
outFile.open(QIODevice::WriteOnly, QuaZipNewInfo("SomeFolder\\"));
outFile.close();

Resources