I'm new in Google Apps Script, and I have been searching and trying to do a script that deletes the content of a folder (folder a) without going to trash, then copy another folder with content (folder b), and move the content of the copied folder (copy of folder b) to the first folder (folder a).
I know that this can be confusing but I can´t explain another way :(
Thanks :D
For unix-like OSes:
rm -rf folderA
cp -pR folderB folderA
Related
im currently setting up a cpanel.yml file and i need to copy all the file inside one specific folder in my repository to my /public_html.
/bin/cp -R build $DEPLOYPATH
the code above copy the build folder to the /public_html. But i need to copy all the file inside it not the actual build folder.
any suggestion how to do it? any help would be appreciated. thanks
Is it possible to copy only a group of files without erasing some files in destination folder.
I have a folder « One » with contain :
file-b.php
file-d.php
In folder « two », I have
file-a.php
file-b.php
file-c.php
file-d.php
I want to copy files from folder « One » to folder « two » I just want to replace file-b.php end file-d.php without erasing file-a.php and file-d.php
A the end, folder « two », should be like this :
file-a.php
file-b.php (modified)
file-c.php
file-d.php (modified)
I've tried various things with mv and cp without success.
I thought I should delete my question since I found a solution. In case it could help, here is my solution :
cp -Rf /path/to/folder-1/* /path/to/folder-2
-R instructs cp to copy files recursively (for example, a whole directory). To overwrite already existing files you should use the -f argument:
I'm trying to change the permissions of a folder. I want to make a folder, and everything in it restricted to me only; other users can't view it.
The folder, though, contains hundreds of other files in it. Is there a way in Terminal to change the permissions a folder and everything in it? I know this can be accomplished with "Get info" but there's simply too much files inside that folder to manually do that with every file.
I'm running on OS X Mavericks 10.9.5.
Help would be greatly appreciated!
of course there is a way.
You should set the ownership to your user and remove at least the executable flag for the folder. No one will be able to enter the folder via the cd command or the finder, etc.
First change directory to the location where the desired folder is located (its parent folder).
cd path/to/parent/folder
then remove the executable flag for its group (g) and all others (o)
chmod go-x folder
If you also want to make its contents invisible for actions like
ls folder/
then you have to remove the readable flag also.
chmod go-r folder
#micebrain: And there is no need for changing the permissions recursively for all folders and files inside the folder, because you can control the access of opening a folder.
BTW the executable bit (x) - if set - makes files executable and folders openable...
I've been searching around for quite some time but nothing I've found seems to work for me.
I would really like to move the files to another folder on the same drive if possible just in-case the drive happens to be low on space. but none of the move scripts i found seemed to work for me.
i've tried using move, move-items, copy, xcopy, and even robocopy.
robocopy is the only one to work for me so far even tho its creating a new file, it also creates a subfolder that the file is in. in the new location.
so this how my work looks so far
D:\DVDBD-Projects\Project1\
Movie1\
Movie2\
Movie3\
there is a .mkv file in each movie folder and I would like to move the .mkv in each folder under projects to a new location without creating the folder it was originally in.
So the .mkv files will be moved to D:\DVDBD-Projects\Complete without any folders just mkv files.
This is my code
robocopy "D:\DVDBD-Projects\Project1" "D:\DVDBD-Projects\Complete" *.mkv /s
this will copy the files to the new location but also create the movie1 folder and so on. if i dont use the /s switch it wont look inside the subfolders and copy the files.
So i was hoping you guys could help me out, is there a way that i can copy or move just the .mkv files to the complete folder.
i plan on adding this code to script that encodes the movies from my camera so it saves me alot of point and clicking and cutting and pasting.
*note - looks like i can use this code
pushd "D:\DVDBD-Projects\Project1"
for /r %%a in (*.mkv) do (
MOVE "%%a" "D:\DVDBD-Projects\Complete\%%~nxa"
)
popd
this will take all files from subfolders and move them to the destination folder
i could probably also install xxcopy which extends xcopy which would allow me to copy the files from sub directories without creating new folders in the destination
for /f "delims=|" %%s in ('dir /ad/b') do robocopy "\\source\%%s\" "destination\" *.mkv /s
This is what I want to achieve:
Dropbox Directory Structure:
Dropbox/
1passwordstuff
Music
documentfolder1
documentfolder2
Documents Structure:
Documents/
documentfolder1
documentfolder2
Then, I want to do all of my work within the Documents folder. So let's say I make some changes to a file in documentfolder1, then I want to call a command like rsync ... and have all of my changes pushed into Dropbox. I've managed to achieve this with rsync -r --ignore-existing Documents Dropbox but there's a problem. Let's say I delete some files in Documents/documentfolder1/somefile then I want those files in my Dropbox folder to also get deleted. I don't know how to do this.
Any help?
Voted to close, since this question isn't programming-related, but I think you want rsync --delete.
Why not simply use the symbolic links?
Create a symbolic link in the dropbox folder to the Documents folder, and everything will get synced, and you still will work in your Documents location.
just go to your dropbox folder and run
ln -s PATH_TO_DOCUMENTS Documents