Use this tag for questions about file management and operations on files.
5
votes
2answers
448 views
Immutable bit on AIX?
Under Linux I can:
chattr +i SOMEFILE
so that even root can't modify the SOMEFILE. Are there any similar solutions for AIX?
2
votes
2answers
36 views
How to automatically apply changes in a folder to another?
Running Ubuntu 12.04, I work software "production" on certain folders and then I usually copy files I make up to another paths where I do the "deployment".
For example, sometimes I produce some files ...
6
votes
4answers
165 views
Add lines to the beginning and end of the huge file
I have the scenario where lines to be added on begining and end of the huge files.
I have tried as shown below.
for the first line:
sed -i '1i\'"$FirstLine" $Filename
for the last line:
sed -i ...
1
vote
2answers
72 views
Find and move directories based on file type and date
I have a directory "New Movies" containing 200+ subdirectories "Movie Name (year)". The subdirectories "Movie Name (year)" contains a single video file (avi/mkv) and several related jpg/xml files.
I ...
1
vote
4answers
36 views
how to merge different files that have the same header but slightly different file name?
I have a problem in merging files for a big data sets like below.
I want you help me to let me know the script that can do such task.
fine name: fluxes_year_lat_long
I have 30 years of daily fluxes ...
2
votes
1answer
27 views
Renaming files based on the contents of a text file
I have lots of point files I need to change for model input. I want to rename lots of these files based on the contents of a file. These files are text files arranged in rows.
file name: ...
25
votes
6answers
11k views
How can I edit multiple files in VIM?
I know I can open multiple files with vim by doing something like vim 2011-12*.log, but how can I switch between files and close the files one at a time? Also, how can I tell the file name of the ...
2
votes
2answers
49 views
Symbolic link of for my user, doesn't work for root
I am experimenting with the following scheme in order to share common data among different distributions.
In Fedora I have created a symbolic link /home pointing to:
...
2
votes
4answers
57 views
Shell script to check for the presence of one or more files with a specific extension?
I want to write a script to find a file with specific extension.this much i have done:
#!/bin/bash
file="/home/Savio/Dsktop/check/*.csv"
file1="/home/Savio/check/*.txt"
if [[ -f "$file" && -f ...
3
votes
2answers
36 views
Overwriting an input file
Solutions that I have come across for replacing the contents of an input file with converted output involve using a temp file or the sponge utility.
Stephane Chalezas's answer here indicates another ...
1
vote
1answer
49 views
Strange problem with IO or file system or what?
On a SLES 11 SP2 32-bit system I'm seeing a strange problem. It's as if the OS can not open a file from the beginning of the file.
Say I have a file that is 200 lines. If I cat or more or vi the ...
3
votes
1answer
46 views
copying files from one directory to another
I have to copy a set of files from one folder to another folder and I'm using the following command:
cp -rf `head -n 100 /home/tmp/abc.txt` /home/tmp/test/files
the file contents in abc.txt is ...
2
votes
3answers
117 views
How to determine how many files are within a directory without counting?
I've been having a fairly serious issue on a high traffic web server. PHP pages are slowing down considerably, and it only seems to be an issue on pages where sessions are accessed, or a certain table ...
3
votes
1answer
47 views
Files have the same inode but they don't link to each other
I have a bash script in two places and I can't remember how I created them. they have the same inode but none of them seem to link to another. is there a hard link but should not Links count for that ...
11
votes
3answers
218 views
How do I loop through only directories in bash?
I have a folder with some directories and some files.
for d in *; do
echo $d
done
will loop through all files, but I want to loop only through directories. How do I do that?