General :: Removing Subdirectorys And Only Working With Files (Bash Cookbook 5.8)?
Jul 6, 2010
The Cookbook gives us
for FN in $*
do
echo changing %FN
chmod 0750
done
but that changes all. how can I change all files but subdirectorys? I was thinking of something likels -l | grep -v ^d but can't get it to work. I'm still learning about variables and how to use them. thanks in advance for your Patients.
View 2 Replies
Jun 6, 2011
I want to develop a bash or Perl script that will evaluate files in the local directory and delete every file that is older than a specified time period, such as three months.I write documents and save the latest modifications by putting the current date in the filename, so I can easily see which versions are the newest. I would like to clean up my directory every once in a while, though, by eliminating the copies that are more than a few months old.
View 14 Replies
View Related
Dec 9, 2010
HOWTO: Create a Recipe Cookbook in OpenOffice 3.3 This HOWTO: will guide you through the process creating a Recipe Cookbook in OpenOffice 3.3.
PREWORK: Before staring to type in all your favorite recipes, and formatting each section of text, there are a few decisions that will affect your layout. They are:
1. Paper Size: 8.5" x 11", 8.5" x 14", or 11" x 17"
2. Binding: 3 Ring or Spiral
3. Columns per Sheet of Paper: 2, 3, or 4
[code]....
I chose 8.5" x 11", 3 Ring, 2 Columns, TimesNewRoman, Portrait, and Double Sided. These choices specify two recipe pages on each side of a sheet of paper, making a total of four recipe pages printed in some specific order on one sheet of paper to create a Recipe Booklet. I prefer a 3 Ring Cookbook to the Spiral Bound versions as the 3 Ring version pages don't get mangled. The separator line down the center of the layout may be used for manual cutting the sheets when you are finished printing. Your decisions may vary from mine, making your layout different depending on your test printing results.
LAYOUT THE COLUMNS:
Formatting a Single Sheet of Paper in OpenOffice 3.3:
FORMAT -> PAGE -> 2 COLUMNS
SPACING 1.30" with a Separator Line of NONE (This is because my Brother HL-2140 doesn't print them equal side to side) This will give you an area for each page (Left & Right) on each side of the Sheet of Paper. It is within this area that your text will be formatted according to your planned layout. Use recipe1.png & recipe2.png below to assist you in laying out your design. Once your 8.5" x 11" sheet has the proper layout save the file.
ADD/DELETE PAGES: Open your layout and keep the "enter key" depressed to create the needed pages. Likewise move your cursor to the last row in the last column of the last sheet and keep the "delete key" depressed to remove the extra pages. Save your file.
CALCULATING PAGE LAYOUT ORDER:
Since each Sheet of Paper may contain 4 printed pages, the total number of pages CREATED in OpenOffice 3.3 needs to be a multiple of FOUR. For example, I typed in 104 pages in OpenOffice 3.3 and this will create 26 ODD Pages and 26 EVEN Pages. For my Recipe Book the page order was:
ODD
104,1,102,3,100,5,98,7,96,9,94,11,92,13,90,15,88,1 7,86,19,84,21,82,23,80,25,78,27,76,29,74,31,72,33, 70,35,68,37,66,39,64,41,62,43,60,45,58,47,56,49,54 ,51
EVEN
2,103,4,101,6,99,8,97,10,95,12,93,14,91,16,89,18,8 7,20,85,22,83,24,81,26,79,28,77,30,75,32,73,34,71, 36,69,38,67,40,65,42,63,44,61,46,59,48,57,50,55,52 ,53
[code]...
View 1 Replies
View Related
Feb 18, 2010
The following script will work when I type the path to the file I want to checksum, but not when I drag the file to the terminal because the linux terminal (unlike the Mac) automatically puts quotes around the file path, which causes an error. I did not find anything in gconf-editor or anywhere else to alter this behaviour, and my post in Launchpad is unanswered so far. (the script in itself is not very useful, I just stumbled upon this error when experimenting with bash).
So, is there a workaround for stripping the quotes from the input, or can I configure the terminal to not quote the input when I drag a file into it (which I would prefer?)I am currently logged in from Mac OS, but the question refers to ubuntu karmic with which I dual boot.ADMINISTRATORS: Thanks for the quick reply to my newbie question about posting new threads. Actually I don't see now what the difficulty was; I guess I was tired from trying to debug the above script (not funny).
View 1 Replies
View Related
Sep 1, 2010
I've got a basic script, which parses data from a text file and performs actions based on that data. Here is my code:
Code:
dsrc="/home/russellm/sites/"
ddst="/home/russellm/othersites/"
while read SiteID
do
if [[ ! -d "$ddst${SiteID:0:1}" ]]
then
mkdir "$ddst${SiteID:0:1}"
fi
mv "$dsrc${SiteID:0:1}/${SiteID%*}" "$ddst${SiteID:0:1}/" | tr -d '
' done < sites.txt
The text file came from a windows system, and contains those return characters (). I 'could' just run the whole thing through tr and then run the script on the new data file, but I'm looking for a more elegant solution. As the code above shows, I'm trying to pipe the mv command though tr in order to remove the return character - but it's not working. I can't get this to work with sed either, so I know I'm doing something wrong. I also tried to remove it using ${SiteID%} - but that also failed. The characters don't show up in an echo, just when executing a command.
Output example (emphasis mine):
Code:
mv: cannot stat `/home/russellm/sites/B/B23467324
': No such file or directory
I'm tempted to just convert the file once and call it a day, but you know what it's like. To be honest, I'm starting to suspect that there are no return characters, and that I'm going about this wrong.
View 4 Replies
View Related
Sep 10, 2010
This is a really odd bug I can't seem to figure it out. Basically, commands like ls can see all the files in the current directory, however when I go to execute the file it will give errors like "file not found", even when it most obviously is. If you look at my command history in the screenshot, you can see I can ls into a directory and see it's contents. When I try to run the file, I get the "no such file or directory" error.
However, if I type simply 'vm', I can't use tab completion to complete the directory name, and my third command is me typing 'vm' and hitting tabtab, it lists a bunch of vmware specific tools instead of the subdirectory name. I can then ls and see my current directory contents, and it will list only the single subdirectory. However, then I tried to use the full filepath from root to run the file, still to no avail. If anyone has any insight,
View 2 Replies
View Related
Jan 6, 2011
I am currently writing some convenience methods for my terminal in my bash_profile and am sure if what I am writing is "the best way". I figure a good way to verify whether what I'm doing is right or not would be to find some source code of more established programs and see how they do it.My question then is, where can I find this code on my Mac? An example is, with Macports installed, where is the source code that opens the port interactive console when I type nothing but "port" in my shell?(I added Linux in the title even though I am on a Mac because I assume the answer would be the same for both)
View 3 Replies
View Related
Jul 18, 2011
I use Linux. I coded a screenshot program some time ago and now I have 9 GIG of screenshots, 60000 JPEGs, most of them look pretty similar, and I have 300 MB of disk space remaining.
What are some good ways to start to compress batches of them (or all of them) in the background given the limited space? The problem with compressing the folder all at once is that I wouldn't have enough disk space for that. It seems the process needs to be broken down into chunks. So maybe something like: Get a list of all the files Add a chunk of the files (say, 20) to a compressed archive. Once it is done and saved successfully, delete the chunk of files
View 2 Replies
View Related
Jan 27, 2010
I'm trying to write a script to process some images and rename them, or more specifically, renumber them so that pg_0001.png becomes pg_0.png, pg_0002.png becomes pg_1.png, etc. I've looked at the rename command and sed, but I'm not really very familiar with these. It should also be part of a bash script that I've written for the processing of these files - this is what I have so far:
Code:
#!/bin/bash
pdftk 2012 theatre Sep 2009.pdf burst
[code]...
View 5 Replies
View Related
Sep 19, 2009
I'd like to write a bash script to convert all of the .mpg files in a directory to .avi files. The ffmpeg part of this produces the kind of file that I want, but rather than changing the name of the input and output files each time that I run the script, I'd like to automate it. I've tried this script, but I get an error "command not found".
#!/bin/bash
cd /home/michael_s/golf_temp
1 for i in 'ls *.mpg' ; do
/usr/bin/ffmpeg.exe -i /home/michael_s/golf_temp/"$i" -map 0:0 -map 0:1 -pass 1 -vcodec mpeg4 -vtag xvid -f avi -b 1100k -vol 384 -mbd rd -s 640x480 -aspect 4:3 -acodec libmp3lame -ac 2 -ab 128k /home/michael_s/golf_temp/"$i".avi
rm -f /home/michael_s/golf/temp/"$i".avi
/usr/bin/ffmpeg.exe -i /home/michael_s/golf_temp/"$i" -map 0:0 -map 0:1 -pass 2 -vcodec mpeg4 -vtag xvid -f avi -b 1100k -vol 384 -mbd rd -s 640x480 -aspect 4:3 -acodec libmp3lame -ac 2 -ab 128k /home/michael_s/golf_temp/"$i".avi
done
fi
quit
View 5 Replies
View Related
Jun 8, 2010
What kind of method to find the duplicates files on linux,
1.how to find just using the file name, sometimes i figure out people often to copy their files to another directory and i want to find out if there any same file name in the linux box.
2. what about if i want to find the duplicate files based on contents of the file, example is in picture file if users store picture files from digital camera first they just save the file name in default but when they want to give that picture to others they will rename it, i've been used method md5 for this situation in python script but it takes long time
I'm asking this question just to know to use bash script a lot in work and i want to test out fdupes at home, is fdupes use similar md5 scan to find duplicate files?
View 4 Replies
View Related