Copy everything in a directory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Copy everything in a directory
# 8  
Old 04-30-2011
again, it doesnt work, i use it and it copies the entire directory and whats in it. I only want everything in the directory, to be moved to another folder. Basically i have a program that changes this folder constantly to i cant just list all the files in there as they may change.
# 9  
Old 05-01-2011
You cant do that.

If all the files are named the same "basic" are they all in the same directory? If they are, how the heck did you do that?

There has to be a difference in the file name or directory. If not, assuming they are all different, how did you keep them from overwriting one another?

You will need to write a script to move multiple files to a new file. cp and mv use the same syntax, but mv will overwrite, unless you make the file you are moving to unique. But with your situation, use cp.

touch example
cp -i basic example
cp -i basic2 example

the -i checks to make sure that you do not overwrite existing data on the new file. It shouldn't, but I always double check.

You should notice that if you have five files with the same name and directory, this will not be possible. If you are looking for a single line of code to satisfy your need, let me know if you find it. I dont think it exists.
# 10  
Old 05-01-2011
This is hard to explain, let me start by saying that Minecraft a game has a texture pack file, the only way for it to work is by selecting all the files in a directory and compressing it, now the texture packs wont work if you compress a directory, because when minecraft tries to look for the files in the .zip file it only finds the directory i compressed, the files are in there but inside the directory inside the zip file. So my plan is copy all of the files into another folder then select all and compress. I need them to be copied into another directory. so thats why im here asking this.

---------- Post updated at 07:09 PM ---------- Previous update was at 07:08 PM ----------

Wait instead of copying can someone tell me how to compress everything in a folder, not the actual folder. I found an easier way, without the copy command.

---------- Post updated at 07:20 PM ---------- Previous update was at 07:09 PM ----------

Just made a huge lep foward here, by combining a little knowledge on how to net send from windows xp using * instead of your ip address i was able to come up with this cp -a * cd .. this copied everything in the directory to the directory outside it which was the desktop, woot.
# 11  
Old 05-02-2011
cd ..
cd ..
cd users
cd lenzo
cd library
cd application\ support
cd minecraft
cd bin
unzip minecraft.jar -d delete
cd ..
cd ..
cd ..
cd ..
cd desktop
cp char.png /Users/lenzo/Library/Application\ Support/minecraft/bin/delete/mob/char.png
cd ..
cd library
cd Application\ support
cd minecraft
cd bin
rm -rf minecraft.jar
cd delete
zip -r Minecraft.jar *
cp minecraft.jar cd ..
cd ..
rm -rf delete
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy directory without using cp-r

Hi guys, I need a solution to copy files and folders without using cp-r , cp-R or any variants. So i need to code it manually. I allready have a loop #!bin/bash IFS=$'\n' if test "$1" = "" then wd=pwd else wd=$1 fi for file in $(find $1) do if... (1 Reply)
Discussion started by: Wolverine89
1 Replies

2. Shell Programming and Scripting

Copy the files in directory and sub folders as it is to another directory.

How to copy files from one directory to another directory with the subfolders copied. If i have folder1/sub1/sub2/* it needs to copy files to folder2/sub1/sub2/*. I do not want to create sub folders in folder2. Can copy command create them automatically? I tried cp -a and cp -R but did... (4 Replies)
Discussion started by: santosh2626
4 Replies

3. Shell Programming and Scripting

how to copy the directory but not copy certain file

Hi experts cp bin root src /mnt but not copy bin/bigfile any help? ( I post this thread in the "redhat" forum wrongly, I don't know how to withdraw that question in that wrong forum) Thanks (6 Replies)
Discussion started by: yanglei_fage
6 Replies

4. UNIX for Dummies Questions & Answers

How to copy a tree of directory

Mi question is how can you copy only de three of directory and not the files in it. Only a need the three of directorys not the files (6 Replies)
Discussion started by: enkei17
6 Replies

5. UNIX for Dummies Questions & Answers

How to copy a file to a directory?

Hello all, I've been researching this problem for days, and have gotten no luck . =/ How do you copy a file to another directory without being in the same directory as the file? So, for example, say I wanted to copy the file 'my.txt' that is in the directory ' /export/hom0/user/asdf ' to the... (9 Replies)
Discussion started by: kvnqiu
9 Replies

6. Shell Programming and Scripting

Copy Last modified directory to another directory

Hi, I have to copy last modified Directory to another directory.How can i Do using pipe or redirect cp -R 'ls -lrt|tail -1' test is not working. please help. (3 Replies)
Discussion started by: shaveta
3 Replies

7. Shell Programming and Scripting

Copy range of directory name

Hello folks hope all are doing well, i need to compress directories with range, i have total directories from 000-199 and i want to copy directories from 010 onwards to 020 meants total 11 directories, please suggest what regex will i use. Thanks, Bash (2 Replies)
Discussion started by: learnbash
2 Replies

8. Shell Programming and Scripting

Help with directory copy please

Hi, I have a folder that has about 100 directories. They all have different names. I need to do a find and copy of only directories (and their files) that start with ABC. There are directory names as ABCDE,ABCDG,ABCHT and so on. I tried using the AB* but that doesn't work. Can someone... (4 Replies)
Discussion started by: bbbngowc
4 Replies

9. SuSE

cant copy from one directory to another

I faced a problem when I tried to copy files from one directory to another using certain user although this user has r/w/x permission on source and destination directory ?? the OS is Linux-Suse 9 any help?? (2 Replies)
Discussion started by: mm00123
2 Replies

10. UNIX for Dummies Questions & Answers

Copy directory from one location to other

Hi All, I am newbie for Unix. I want to copy a directory from one location to other. Can any one help me by providing the command to do following task. thanks in advance, Rakesh (2 Replies)
Discussion started by: rakeshvthu
2 Replies
Login or Register to Ask a Question