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
SND_FM801(4)						   BSD Kernel Interfaces Manual 					      SND_FM801(4)

NAME
snd_fm801 -- Forte Media FM801 bridge device driver SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file: device sound device snd_fm801 Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): snd_fm801_load="YES" DESCRIPTION
The snd_fm801 bridge driver allows the generic audio driver, sound(4), to attach audio devices based on the Forte Media FM801 chipset. This is a common chipset found in various parts used by OEM manufacturers. HARDWARE
The snd_fm801 driver supports audio devices based on the following chipset: o Forte Media FM801 SEE ALSO
sound(4) HISTORY
The snd_fm801 device driver first appeared in FreeBSD 4.2. AUTHORS
This manual page was written by Joel Dahl <joel@FreeBSD.org>. BUGS
The Forte Media FM801 chipset is a sort of PCI bridge, not an actual sound controller, making it possible to have soundless support. One problem is that both chipsets, with and without sound support, use the same PCI ID. This makes it impossible to determine which one is installed. BSD
December 1, 2005 BSD
All times are GMT -4. The time now is 11:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy