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
obexftp(1)																obexftp(1)

NAME
obexftp - Mobile Equipment file transfer tool SYNOPSIS
obexftp [OPTION] [COMMANDS] DESCRIPTION
obexftp is used to access files on mobile equipment, i.e. cell phones. With obexftpd you can transfer files between any computers using IrDA, Bluetooth and TCP/IP. This tool lets you access the ObexFTP library by the means of a command line interface. You might consider using the other means avail- able. E.g. the ObexFS filesystem for Linux. OPTIONS
The ordering of options is important. Every command will use the most recent device set. Every file without command switch will apply to the command given most recent. See EXAMPLES TRANSPORT OPTIONS -i, --irda Connect using the IrDA protocol. This is the default. -b device, --bluetooth device Connect to this bluetooth device. If the device is not given the first device found will be used. -B number, --channel number Use this bluetooth channel when connecting. The channel will be discoverd automatically if this option is not used. -d no/address, --hci no/address Use the bluetooth device referenced by number or address as source device for the connection. -u intf no, --usb intf no Connect to this usb interface or list all available usb interfaces. -t device, --tty device Connect to this tty device. -n host, --network host Connect to this network host. COMPATIBILITY OPTIONS -U uuid, --uuid uuid Select the UUID to connect with. Recognized values are currently "none" needed by some Nokia mobile devices, "FBS" (default) for the normal file browsing service, "IRMC" for IRMC synchronisation and "S45" when connecting to a Siemens Mobile phone via cable or "SHARP" for PCSOFTWARE UUID with Sharp devices. -H, --noconn Suppress connection IDs (i.e. send no connection header to the mobile). -S, --nopath Don't use "setpath" commands (i.e. send the whole path as filename to the mobile). Can be used together with --noconn and --uuid none to send an OBEX-PUSH. SETTING THE FILE PATH -c folder, --chdir folder Set the mobiles current working directory. -C folder, --mkdir folder Set the mobiles current working directory. The folder will be created if it doesn't exist. -l folder, --list folder List a folder. SENDING AND RETRIEVING FILES -o path, --output path Specify the target file name, overriding the implicit local name from --get or the implicit remote name from --put -g source, --get source Retrieve files from mobile. -G source, --getdelete source Retrieve files from mobile and delete them on the mobile -p source, --put source Send files to the mobile. -k source, --delete source Delete files from the mobile. EXPERIMENTAL EXTRAS -X, --capability Retrieve the capability object from the mobile (if available). -Y, --probe Probe and report device characteristics -x, --info Retrieve misc infos from mobile. I.e. memory size and free memory. Siemens specific for now. -m src dest, --move src dest Move (rename) files on the mobile. Siemens specific for now. VERSION INFORMATION AND HELP -v, --verbose Be verbose and give some additional infos. -V, --version Print version string and exit. -h, --help, --usage Print short usage instructions. EXAMPLES
To get the directory listing from the first irda device obexftp -i -l or just obexftp -l as IrDA is the default. To get the file bar from directory foo from the first bluetooth device obexftp -b -c foo -g bar To send the file bar to directory foo with device on first serial port obexftp -t /dev/ttyS0 -c foo -p bar It is possible to use RfComm (serial port over bluetooth) obexftp -t /dev/rfcomm0 -c foo -p bar And also IrComm (serial port over IrDA) obexftp -t /dev/ircomm0 -c foo -p bar To send the file bar using plain OBEX PUSH obexftp --bluetooth --nopath --noconn --uuid none --put bar SEE ALSO
obexftpd(1), openobex(3), obexftp(3), multicobex(3), libbfb(3). BUGS
Bugs ? Features ! NOTES
The software has been tested and reported working on at least Siemens, Ericsson, and Nokia phones. AUTHOR
Christian W. Zuckschwerdt <zany@triq.net> 17 February 2009 obexftp(1)
All times are GMT -4. The time now is 12:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy