LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-14-2013, 03:20 PM   #1
trafikpolisen
Member
 
Registered: Jun 2008
Posts: 121

Rep: Reputation: 3
Script to hide subdirs with a specific name


I'm trying to prevent Shotwell from importing RAW's. See this thread: http://www.linuxquestions.org/questi...ly-4175445360/
I have an idea to create a script that searches through my photo directory tree and renames every folder named "raw" to ".raw", thus hiding it from Shotwell. I could then import the photos in Shotwell and then run a script to remove the dot from the folder names. A bit crude, but it would sort the problem.
Now, I have close to zero knowledge about scripting, so I need some help. Also, if someone has a better solution to solve the problem, please tell.

Last edited by trafikpolisen; 05-14-2013 at 03:23 PM.
 
Old 05-14-2013, 04:18 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by trafikpolisen View Post
I'm trying to prevent Shotwell from importing RAW's. See this thread: http://www.linuxquestions.org/questi...ly-4175445360/
I have an idea to create a script that searches through my photo directory tree and renames every folder named "raw" to ".raw", thus hiding it from Shotwell. I could then import the photos in Shotwell and then run a script to remove the dot from the folder names. A bit crude, but it would sort the problem.
Now, I have close to zero knowledge about scripting, so I need some help. Also, if someone has a better solution to solve the problem, please tell.
Well, a good place to start would be scripting tutorials:
http://www.tldp.org/LDP/Bash-Beginne...ers-Guide.html
http://tldp.org/LDP/abs/html/

Those can walk you through creating a script, renaming files, looping, etc. From there, you should easily be able to look at the examples/samples, and create something that does what you want. If you get stuck, post what you've written and where you're having trouble, and we'll be glad to help.
 
Old 05-18-2013, 10:02 PM   #3
trafikpolisen
Member
 
Registered: Jun 2008
Posts: 121

Original Poster
Rep: Reputation: 3
After a few hours on Google i've created this:

#!/bin/bash

find /home/myhomedir/Photos -name "raw" -type d | while read fn; do
fn=${fn%raw}
echo mv ${fn}raw ${fn}.raw
done

Comments?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to programmatically (via shell script) hide gnome-panel(s)? ajaygarg Linux - Desktop 3 04-18-2013 07:48 AM
Hide encfs file-systems from being show in file manager. I tried using 99-hide-disks angel'le Linux - General 0 02-18-2013 04:44 AM
Can we hide the code of a Shell Script? kushalkoolwal Programming 35 03-30-2011 04:55 PM
hide terminal window whn running script tank junior Linux - Newbie 1 03-14-2011 12:24 PM
How to hide and block a directory for a specific user hoolie_v Linux - Newbie 2 08-08-2004 07:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration