Ubuntu Servers :: Change The Ownership Of Multiple Files And Directories Under A Specific Subdirectory?

Feb 19, 2010

I have a vary unique problem with file and directory ownership. I need to change the ownership of multiple files and directories under a specific subdirectory.Under this directory structure there are files and directories owned my different users and groups. I need to change all files and directories owned by "user1" to "user2". but if any are owned by "user3" I need those left alone.Is there a simple way to do this or will I need to traverse the structure and change things one at a time.

View 3 Replies


ADVERTISEMENT

General :: Rename Multiple Files In Multiple Directories/subdirectories Recursively?

Aug 23, 2010

I am to rename all the files within a directory (which contains multiple subdirectories) recursively without invalid characters.

I tried the coding posted above.

find . -type f -printf '%p
' | while read file; do
oldfile=$(basename "$file")
newfile=$(echo "$oldfile" | sed 's/[^A-Za-z0-9_.]/_/g')
if [ ! "$newfile" == "$oldfile" ]; then
echo mv "$file" "${file%$oldfile}$newfile"
code....

but I get an error on both of them stating "find: bad option -printf find: [-H | -L] path-list predicate-list"

View 9 Replies View Related

Ubuntu :: Ownership & Permissions Change When Files Burned To DVD+RW?

Jan 18, 2010

After burning files to DVD+RW, the owner is changed to root, and all permissions are read only. I want to periodically open these files, update them, and save to the DVD again, but I no longer have permission and cannot change the permissions since I am no longer the owner. I tried sudo commands, but get responses "Read only file system". I have erased and reformatted the DVD and started over but get the same results.
I have Ubuntu 9.04, and have tried Brasero and Nautilus and get the same problem. Am I using the wrong kind of DVD/CD?

View 3 Replies View Related

Ubuntu Servers :: Cannot Change File Ownership On NTFS Drive?

May 25, 2011

process of migrating my server to Ubuntu Server 11.04 after my Server 2003 installation suffered a HDD failure. All my data is on an NTFS drive (not ideal but not much I can do about that). I can currently only read the disk as a user. root has ownership of everything on the disk. Whenever I try and change ownership of a file it doesn't bring up any errors but when running ls -l it shows that nothing has actually changed.

View 2 Replies View Related

General :: Recursive Delete Specific Files From Sub-directories?

Mar 4, 2011

I would like to be able to recursively delete specific various files from a directory and sub-directories. For example:

Dir/
|_sub1/
|
|_ _rm *file1 *file2 *file3

[code]....

View 11 Replies View Related

General :: Creating A Script To Move Or Copy Files Into Multiple Directories Below The Files?

Aug 25, 2009

How can you create a script to move or copy files from a main directory into multiple directories below the main directory.

View 7 Replies View Related

General :: List Files In Specific Directories Older Than 1 Day Or 24 Hours

Apr 7, 2011

I am trying to write a simple back up script in python where I try to list the files that are 24 hours old in specific directories that I would choose.I read the manual of find and used

find . -mtime 1 > log.dat

to get the list of files in the log.dat however I also get the path information in that list as such

./hpc06MatlabCodes/2011/Apr/3dBoxModel
./hpc06MatlabCodes/2011/Apr/3dBoxModel/vfluidIrca10.dat
./hpc06MatlabCodes/2011/Apr/3dBoxModel/vLRecoveredSystem.mat

is there a way to exclude the directories and only get the files list.

View 2 Replies View Related

General :: Command For Listing Files/dirs Recursively Of Specific Directories?

Jul 22, 2011

suppose in my current directory, I have 50 sub-directories. Now, I am interested only in about 20 of those sub-directories (whose names match a pattern). I would like to recursively list the contents of these 20 sub-directories. How do I do that ? I would like to do this in Solaris 10 and Linux(RHEL 5.x).

View 3 Replies View Related

General :: Assign Read Privileges To User On Specific Directories And Files

Jan 26, 2011

I am using CentOS 5.5 and I created few users (useradd john etc.) and now I want to assign privileges to this user on some directories and files in those directories. For example I want to give read privileges to directory "/documents" and all of files under that directory.

View 13 Replies View Related

Software :: Create Certain Files And Directories With Specific Owners On The Target Machine

Jun 29, 2010

I'd like to create a tar file on my machine to distribute software to other machines which are all alike (including, usernames, groupnames, etc). I need to create certain files and directories with specific owners on the target machine. In order to do that, I use

Code:
tar --create --owner=someone --group=somegroup --file package.tar files. However, for this to work, someone must be in my /etc/passwd and somegroup must be in my /etc/group. Is there a way to fake this so I don't have to create a bunch of users only for that purpose?

View 3 Replies View Related

Ubuntu :: Moving Files From Multiple Directories?

Apr 16, 2010

I have a directory tree with lots of folders. I need to gather all files of same type, say .txt, and place them in a different folder all by themselves.

I know I can use the mv command, but it won't let me go through all the subdirectories of my folder, just the current one. How can I search through all subdirectories for all .txts or whatever and move them to a folder of my choosing?

View 2 Replies View Related

Ubuntu Servers :: Samab With Multiple Users Accessing Different Directories?

Apr 16, 2010

I currently have samba setup and connecting. What I am trying to do is have multiple users with access to different directories. For example , let's say there are folders A B C on my Linux machine. I want one guy to see A and C and another guy to see B and C and a third guy to see them all. But I want each user to have access to change delete or execute the files within these directories that they have access to

View 4 Replies View Related

General :: Copying Doc Files From Multiple Directories To One?

Feb 1, 2010

I have 60+ directory's each containing multiple .doc files. I need to move them to a single directory and keep their file name intact. I don't think cp will do that with out listing all the file names. I was thinking of something like: cp -r /dir/*.doc /newdir . Or should I use a combo like find -type *.doc|cp /newdir?

View 5 Replies View Related

Ubuntu :: Change Permissions - Change Persmissions In A Subdirectory

Sep 1, 2011

If this information excists here so sorry I was not able to find it. How to change permissions in Unbuntu for those people who are trying to change persmissions in a subdirectory.

Open the terminal and then type: Quote: sudo chmod yourpermission number /thenameofyourdirectory

Example:

Quote: sudo chmod 755 /directory

View 3 Replies View Related

General :: Move Some Of The Files From Multiple Directories To One Location?

Jun 17, 2010

I'd like to move a selection of files from all the sub-directories within an overall directory to a single destination. I don't want any of the directory structure, just the files themselves. This is what I tried so far:

mv /dir1/*/igs*.sp3.Z /dir2

There are other .sp3.Z files in the * directories within /dir1 but I just need the ones that start with igs..

View 4 Replies View Related

Ubuntu Multimedia :: Set Specific ID3 Tags For Multiple Files?

Mar 22, 2010

How can I set specific ID3 tags for multiple files? For example, I would like to set all files in a directory to the same album. (directly setting the album tag for files in a directory to the directory name would be even better)

View 2 Replies View Related

General :: Automate Copying Files To Multiple Directories With Log For Admin

Sep 30, 2009

Description: I am a newly appointed system engineer taking care of linux servers. We have a new set of data coming in which need below configuration: How to do a script with function?:

for files with ".txt" in sm
copy each of the files to folder : sm1 and sm2 (log every copy)
if succesful:
remove original
log into the log file
if not successful: (not successful copying 1 particular file to all the folders)
retain and retry
log into the log file
mail out the admin with that particular file name

I have already do try a bit:
cd /export/home/
for dir in sm1 sm2; do
cp -p sm/*.txt $dir/
done
Is my starting right? How to do the rest parts?

View 6 Replies View Related

General :: Giving Ownership While Creating Directories?

Jan 27, 2010

Is there any way by which one can give ownership while creating directories itself. It should be one command otherwise it requires root login to change ownership of a directory.

View 4 Replies View Related

General :: Making Specific Script Loop Over Multiple Files In Directory?

May 10, 2011

I am trying - to no avail - to take an old script I found in the forum help-needed-in-grep-for-tar-gz-658730/ The code:

Code:
#!/bin/bash
if zgrep $1 $2 > /dev/null 2>&1

[code]....

View 3 Replies View Related

General :: Multiple Users To Create Directories Over SFTP So The New Directories Keep The Same Permissions?

May 15, 2011

I want to make a webserver with multiple users allowed to login through SFTP to a specific folder, www.Multiple users are added, lets say user1 and user2, and all of them belonging to the www-data group. The www directory has an owner www-data and a group www-data.

I have used chmod -R 775 on the www folder, but after I try to create a folder test through my SFTP server (using Filezilla) the group of the directory created has only r and x permissions, and I am not able to log in with the second user user2 and create a directory within www/test due to a lack of w permission to the group.

I also tried using chmod 2775 on www directory, but without luck. Can somebody explain to me, how can I make it so that a newly created directory inherits the root directory group permissions?

View 2 Replies View Related

Ubuntu Servers :: Cp Only Copies Directories And Not Files?

Sep 27, 2010

I am trying to copy the files from my WHS disk to my Ubuntu Server disk. I have the windows disk mounted at /media/WINDOWS and I want to transfer to /storage so I ran;Code:sudo cp -r /media/WINDOWS /storageIt takes about 4-5 seconds and is complete, but there is about 500 GB worth of data there so I know it didn't really copy everything over. When I look at the files in console it shows them, but when I look at the /storage through SAMBA on my Windows machine, it only shows the directories.?

View 9 Replies View Related

General :: Copy Everything In A Subdirectory Across To The Relevant Subdirectory Elsewhere

Sep 16, 2011

At the moment I'm doing:

for i in mdx/[0-9][0-9].png; do cp $i ../../d_s_c/images/mdx ; done

But as well as the directory mdx, I also have other directories called ntt, etc.

How can I say 'For everything in a subdirectory, copy it across to the same subdirectory over at at ../../d_s_c/images'?

View 1 Replies View Related

General :: Copy Lines Starting And Ending With Specific Pattern From Multiple Files To A File?

Jul 27, 2011

A function by name abc is called in many files. I want to copy all the lines with the function call to an output file.A simple grep on function name doesn't help me as the function call is spanning across multiple lines as follows:

abc(parameter1,
parameter2,
parameter3);

So I want to copy all the three lines (till semicolon) to the output file.The problem is because there are more than 200 calls for the same function and I cannot do it manually

View 2 Replies View Related

General :: Replace ":" From Multiple Files Names - Even Recursively In Directories

Jan 31, 2010

I need to replace ":" from multiple files names, since I am going to copy those files from a linux partition, which admit the ":" to a FAT32 partition, which does not.

Example:
original name: eg06_ana_21-05-06_09:21:03.JPG
wished name: eg06_ana_21-05-06_09-21-03.JPG

I have googled a lot but I have not been able to adapt the examples given by people to my aim.

It seems that rename command is what I should use, but I have no idea to build the correct pearl expression.

View 3 Replies View Related

Ubuntu Servers :: Upload Files Via FTP To A Specific Folder (/var/www/myfolder/)?

Dec 22, 2010

When I try to upload files via FTP to a specific folder (/var/www/myfolder/) I get the message 550 permission is denied. I set CHMOD 777 for this folder (I had to do this via SSH cause I was not allowed to do this in FileZilla)

View 5 Replies View Related

General :: Literate Way Of Moving All Files To New Subdirectory?

Jul 19, 2010

$ mkdir backup && mv * backup/
mv: cannot move `backup' to a subdirectory of itself, `backup/backup'

Works, but issues a warning. Also exit code is 1.

How to do it properly (but not [much] longer)?

View 2 Replies View Related

Server :: Ownership For Multiple Groups To A Single Share?

Feb 4, 2010

I have configured a file server with samba and winbind in RHEL5.I am able to allot permission for the active directory groups to my Linux folder.No issues.But i want to set multiple groups of active directory to get ownership to a single directory. Say there are 3 groups a,b,c to have permissions to a folder of the Linux machine.

Code:

chown -R root:Active_directory_group_name path_to_linux directory

I have set

Code:

chmod 770 /myshare

meaning that user and group would have full rights to /myshare

Code:

chown root:a

works great I tried with the option of

Code:

chown -R --reference=/etc/shares_own.txt /myshare

In reference file(shares_own.txt) i gave the entry as

Code:

root:a,b,c

This is not working.

View 7 Replies View Related

Ubuntu :: Can't Change Ownership Of Folder?

Feb 19, 2010

I've tried using chown to change the owner on one of my folders - but to no luck? This is what I run on the terminal - and there's no output. And when i view the permissions of the folder it's still set to root?[URL]

View 9 Replies View Related

Ubuntu :: Change The Ownership Of A Folder?

Jun 30, 2010

how to change the ownership of a folder and everything within it through the Terminal. chown, in this case, isn't going to work.

View 9 Replies View Related

Ubuntu :: Way To Change Ownership Of File

Jul 7, 2010

I need to install a script into my Gimp folder which is owned by root. I tried "chown my name usr/ share/ gimp2.0/scripts" in terminal, but it tells me folder does not exist. I know I'm missing something, but I haven't done this in a while, so I'm not sure what it is.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved