Sponsored Content
Top Forums Shell Programming and Scripting Ignore Folder in Shell Script ? Post 302839785 by pasc on Friday 2nd of August 2013 05:20:59 PM
Old 08-02-2013
Sadly it still extracts the debs in the Subfolder.

Maybe the solution would be to *only* extract the files inside the Downloads folder completly ignoring any subfolders there might be ?

If there is no solution to this I might aswell temporarily move the folder out of the way, but that is onyl my last resort.

Thanks.


EDIT:

Ha! that is too funny, even when I change my code to hamper with the permissions/and or move the folder away for the time the extracting takes place and move it back right after/rechange the permissions it STILL hampers with the debs in the sub dir:

Code:
sudo chmod -R 777 /var/mobile/Media/Downloads
sudo chown -R mobile:mobile /var/mobile/Media/Downloads

#sudo mv "/var/mobile/Media/Downloads/New Debs and Files" /var/mobile/Media/
sudo chmod -R 000 "/var/mobile/Media/Downloads/New Debs and Files"
sudo chown -R wheel:wheel "/var/mobile"Media/Downloads"New Debs and Files"

find /var/mobile/Media/Downloads/ -name "*.deb" | xargs -I {} dpkg -x {} {}.x
find /var/mobile/Media/Downloads/ -name "*.deb" | xargs -I {} dpkg -e {} {}.x/DEBIAN
sudo chmod -R 777 /var/mobile/Media/Downloads
sudo chown -R mobile:mobile /var/mobile/Media/Downloads
#######
# Remove .deb.x extension from any directory name
# DIR=/var/mobile/Media/Downloads
DIR=/var/mobile/Media/Downloads
echo Before:
file $DIR/*
for old_sub in $DIR/*.deb.x; do
  if [ -d "$old_sub" ]; then
    new_sub=$(echo "$old_sub" | sed "s/\.deb\.x$//")
    if [ -d "$new_sub" ]; then
      echo "$new_sub" already exists
      # take action, such as: rmdir "$new_sub"
      # take action, such as: rm -r "$new_sub"
      # take action, such as: exit
    fi
    mv "$old_sub" "$new_sub"
  fi
done
echo After:
file $DIR/*
ls -ld $DIR/*
clear

#mv "/var/mobile/Media/New Debs and Files" "/var/mobile/Media/
sudo chmod -R 777 "/var/mobile/Media/Downloads/New Debs and Files"
sudo chown -R mobile:mobile "/var/mobile"Media/Downloads"New Debs


Last edited by pasc; 08-02-2013 at 08:18 PM.. Reason: Added new Approach
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Trick to ignore space in folder name

Hello All, I am getting error while passing a folder name that has space to the cmd line argument. sh log_delete2.sh "/home/kumarpua/TESTARTIFACTS/atf-chix/ATF-subversion-dev/ssenglogs/A RM" log_delete2.sh: line 17: cd: /home/kumarpua/TESTARTIFACTS/atf-chix/ATF-subversion-dev/ssenglogs/A:... (3 Replies)
Discussion started by: pulkit
3 Replies

2. Shell Programming and Scripting

shell script for moving all the file from the same folder

Hi , I need a shell script which basicaly moves all the files from one folder say folder x to folder y and once they are moved to folder y a datetimestamp should be attached to there name for ex file a should be moved to y folder and renamed as a_20081015 (1 Reply)
Discussion started by: viv1
1 Replies

3. UNIX for Dummies Questions & Answers

Shell Script to Delete 1 folder and keep 5

I have situation that I had originally thought would be easily remedied until I learned more about how -mtime actually works. We have one server that collects backups from a number of other servers. The backup server is limited in space (for reasons that predate my employment). The standard... (4 Replies)
Discussion started by: greendevil
4 Replies

4. Shell Programming and Scripting

Shell Script to ignore # and take corresponding user and group

Hi, I have a following file: role.IMPACT_USER.user=admin role.IMPACT_USER.user=dd12345 role.IMPACT_USER.user=ss76767 #role.IMPACT_USER.user=root #role.IMPACT_USER.group=System role.IMPACT_USER.group=ImpactUser #Description: Allow users to login in to Impact, start and stop service... (5 Replies)
Discussion started by: dbashyam
5 Replies

5. UNIX for Dummies Questions & Answers

Shell script folder creation

hi can any one help me in shell scripting where in my requirement is to write a shell script where in if i run that script i should copy all the .doc files from one system to another systems within a network like from parent folders to child folder example parent folder A within parent folder... (5 Replies)
Discussion started by: afra
5 Replies

6. Shell Programming and Scripting

Ignore lines in Shell Script

Hi, I have a shell script, which reads a *.txt file - line by line. In this text file, I have some lines beginning with "#" that I want to ignore : MY_FILE #blah blah blah 1 blah blah blah 2 blah blah blah 3 #blah blah blah 4 I want my script to read only the following lines... (3 Replies)
Discussion started by: ad23
3 Replies

7. Shell Programming and Scripting

Shell script for FTP folder pattern

Hello, I have 3 folders on FTP server in the format yyyymmddhhmiss as below,ftp> cd /home/walgreens 250 CWD command successful ftp> ls 200 PORT command successful 150 Opening ASCII mode data connection for file list 20150708072901 20150708092901 20150708102901The above folders are in... (1 Reply)
Discussion started by: pavan_test
1 Replies

8. Shell Programming and Scripting

Shell script to copy files from on folder to another

I am trying to copy files with specific date and name to another folder. I am very new to shell scripting so i am finding it hard to do that. see the sample code i have written below. srcdir="/media/ubuntu/CA52057F5205720D/Users/st4r8_000/Desktop/office work/26 nov"... (13 Replies)
Discussion started by: Aqeel Abbas
13 Replies

9. Shell Programming and Scripting

Request for Shell script to move files from Subfolder to Parent folder and delete sub folder

Hi Team, I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder. Eg: parent folder --> /Interface/data/test/IN Sub folder -->/Interface/data/test/IN/Invoice20180607233338 Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies

10. UNIX for Beginners Questions & Answers

How to ignore mutiple strings when using shell script?

Hi All, I am trying to use below syntax to find ignore multiple locations while searching for a file. find / -name "$serviceitem" ! -size 0 2>&1 |egrep -v "tmp|docker|WinSxS|Permission|HISTORY|alternatives|bearer11ssl|manifest" I tried to assign all the ignore strings to one variable... (2 Replies)
Discussion started by: sravani25
2 Replies
QBOOBMSG(1)						      General Commands Manual						       QBOOBMSG(1)

NAME
qboobmsg - Qt application to read an reply to messages on various websites SYNOPSIS
qboobmsg [-h] [-dqv] [-b backends] ... qboobmsg [--help] [--version] DESCRIPTION
Qt application allowing to read messages on various websites and reply to them. Supported websites: * aum ("Adopte un Mec" French dating website) * bnporc (BNP Paribas French bank website) * bouygues (Bouygues Telecom French mobile phone provider) * dlfp (Da Linux French Page news website) * ecrans (Ecrans French news website) * fourchan (4chan image board) * hds (Histoires de Sexe French erotic novels) * inrocks (Les Inrocks French news website) * lefigaro (Le Figaro French newspaper website) * minutes20 (2 Minutes French newspaper website) * newsfeed (Loads RSS and Atom feeds from any website) * okc (OkCupid dating website) * orange (Orange French mobile phone provider) * phpbb (phpBB forum) * presseurop (Presseurop website) * sfr (SFR French mobile phone provider) * taz (Taz newspaper website) OPTIONS
--version show program's version number and exit -h, --help show this help message and exit -b BACKENDS, --backends=BACKENDS what backend(s) to enable (comma separated) LOGGING OPTIONS
-d, --debug display debug messages -q, --quiet display only error messages -v, --verbose display info messages --logging-file=LOGGING_FILE file to save logs -a, --save-responses save every response COPYRIGHT
Copyright(C) 2010-2011 Romain Bignon For full COPYRIGHT see COPYING file with weboob package. FILES
"~/.config/weboob/backends" SEE ALSO
Home page: http://weboob.org/applications/qboobmsg qboobmsg 0.c 04 May 2012 QBOOBMSG(1)
All times are GMT -4. The time now is 08:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy