[Solved] Using Shell in Base to Execute Linux Commands.

Discuss the database features
Post Reply
User avatar
Steve R.
Posts: 163
Joined: Mon Sep 21, 2009 12:06 am
Location: Morehead City, North Carolina

[Solved] Using Shell in Base to Execute Linux Commands.

Post by Steve R. »

I am working on a program where I need to import a file list into Base. I can get the file list developed and imported into Base, but it has to be done through a manual process that I would like to automate.

The following code works from the command line to generate the file list.

Code: Select all

find /media/My_Passport/Music -type f -name '*.mp3' -print0 | xargs -0 stat -c'%12s %n' > music.txt
I can also use this code in a shell script that is invoked from the command line, titled "Generate_MP3_List.sh"

Code: Select all

#!/bin/bash
     find /media/My_Passport/Music -type f -name '*.mp3' -print0 | xargs -0 stat -c'%12s %n' > music.txt
#printf "Done \n"
However, when I try to run this code within Base it fails.

Code: Select all

Sub GeneratePlayList
	shell "bash -c '/home/steve/MP3_Copy_Project/Generate_MP3_List.sh'"	
End Sub
This also fails.

Code: Select all

Sub GeneratePlayList   	
	shell "bash -c 'find /media/My_Passport/Music -type f  -name *.mp3 | xargs -0 stat -c '%12s %n' > /home/steve/MP3_Copy_Project/music.txt'"
End Sub
However, if I remove "xargs", the code does run, but does not give the desired results.

Code: Select all

Sub GeneratePlayList   	
	shell "bash -c 'find /media/My_Passport/Music -type f  -name *.mp3 > /home/steve/MP3_Copy_Project/music.txt'"
End Sub
I suspect that the failure of the code to run in Base may be related to the quotes in '%12s %n'. I have experimented with several quotation modifications and even used xargs arguments not requiring any quotation marks to no avail. How can the code above be made to work with xargs under Base with the shell function?
Last edited by Steve R. on Wed Feb 12, 2014 4:59 am, edited 1 time in total.
Ubuntu 16.04 and Windows 10
rudolfo
Volunteer
Posts: 1488
Joined: Wed Mar 19, 2008 11:34 am
Location: Germany

Re: Using Shell in Base to Execute Linux Commands.

Post by rudolfo »

I haven't much experience with OpenOffice on Linux systems, because I typically run my Linux systems without X and mostly only in a ssh terminal. But from the Windows Environment I know that output redirection and the shell command of OpenOffice Basic don't cooperate nicely.
Based on this observation my guess is that calling the shell script by name has the best chances to succeed. But calling the script with -c is wrong. -c stands for commands (follow). In your case a filename follows. It is analogous to perl: If you type -e perl executes what follows after -e in quotes, but if you want to execute a perl script file it is simply: perl theScript.pl

So a more promising approach would be:

Code: Select all

Sub GeneratePlayList
   shell "bash /home/steve/MP3_Copy_Project/Generate_MP3_List.sh"  
End Sub
And if your Generate_MP3_List.sh has a proper SheBang line and is executable (chmod +x) a

shell "/home/steve/MP3_Copy_Project/Generate_MP3_List.sh"

should be good enough.

Alternatively you can use Python and either os.path.walk or os.walk which is the Python way to recurse through directories. Might be not a one line script as with find, but it shouldn't be more then 10 lines.
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
User avatar
Steve R.
Posts: 163
Joined: Mon Sep 21, 2009 12:06 am
Location: Morehead City, North Carolina

Re: Using Shell in Base to Execute Linux Commands.

Post by Steve R. »

Thanks. It worked. Unfortunately, I am not familiar with Python. The program I am working on copies files randomly from your hard drive to a USB drive that I have in my car.
The program was originally done in MS Access and I am rewriting it using Base. Final code for "Generate_MP3_List.sh"

Code: Select all

#!/bin/bash
# http://www.commandlinefu.com/commands/using/xargs/25
find /media/My_Passport/Music -type f -name '*.mp3' -print0 | xargs -0 stat -c'%12s %n' > /home/steve/MP3_Copy_Project/music.txt
Final subroutine in the Base program.

Code: Select all

Sub GeneratePlayList
   	shell "/home/steve/MP3_Copy_Project/Generate_MP3_List.sh"
End Sub
Thanks again.
Ubuntu 16.04 and Windows 10
RPG
Volunteer
Posts: 2261
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by RPG »

Hello

I have the question why do you not use the BASIC function dir?

Romke
example code

Code: Select all

sub checkfiles
dim sName
sName = dir("/home/romgro/Documenten/opof/data/database/DivVoorrbeelden/Burenregeling/maakdatabase/*odb",0)
do while sName <> ""
print sName 
sName =  dir
loop
end sub
LibreOffice 24.8.5.2 on openSUSE Leap 15.6
User avatar
Steve R.
Posts: 163
Joined: Mon Sep 21, 2009 12:06 am
Location: Morehead City, North Carolina

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by Steve R. »

RPG wrote:I have the question why do you not use the BASIC function dir?
Ignorance. Yes, it (using Basic directly) is an option that I should have considered. My focus, since moving to Linux from Windows, has been to learn Linux, so I was focusing on using Linux, which still includes Basic. Unfortunately I overlooked that fact.

Ironically, my early rendition of the program (in Windows) did use (MS Windows) Basic to develop the text file. Subsequently, I found-out how to directly import the file names directly into MS Access (see code below) and I updated my program. The downside of what I currently wrote as (Base) code is that it is a two step process. It should be done in one step. Eventually, I hope to have (Base) code similar to that (MS Access) code below. The sample code you provided below may well achieve that objective.

One of the "big" issues that I will have, with this project is that with the MS Access version I used a lot of VBA Code to manipulate recordsets rather than SQL. In reading the posts here and the Base Documentation, using SQL is the preferred approach. Consequently, I will be having to get beyond the rudimentary basics of SQL. So I still have a lot to learn. Since this is a casual project, it will be a long-term evolution with many more questions to come.

I have also found the Access2base website very useful.

I still have a long way to go.

MS Access code for recursively finding and importing file names directly into the MS Access database.

Code: Select all

Public Sub Create_File_List(InputPath As String)
    Dim CopyMP3RS As DAO.Recordset
    Dim Fso As Object
    Dim Fldr As Object
    Dim SubFldr As Object
    Dim F As Object
    Dim intStringLength As Integer
    Dim strSongName As String
    Set Fso = CreateObject("scripting.filesystemobject")
    Set Fldr = Fso.GetFolder(InputPath)
    Set CopyMP3RS = CurrentDb.OpenRecordset("SELECT * FROM tblMP3_FileList", dbOpenDynaset)
    For Each F In Fldr.Files
        If Right(F.Name, 3) = "mp3" Then
        Rem intStringLength = Len(F.Name)
        Rem strSongName = Left(F.Name, intStringLength - 4)
            Rem Debug.Print F.Path
            CopyMP3RS.AddNew
                CopyMP3RS!FileLocation = F.Path
                CopyMP3RS!FileName = F.Name
                Rem CopyMP3RS!FileName = strSongName
                CopyMP3RS!FileSize = F.Size
            CopyMP3RS.Update
            End If
    Next F
    Rem ---------------------------------------
    For Each Fldr In Fldr.SubFolders
         Call Create_File_List(Fldr.Path)
    Next Fldr
End Sub
Ubuntu 16.04 and Windows 10
RPG
Volunteer
Posts: 2261
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by RPG »

Hello.

When you want insert data in a table then use parameters.
viewtopic.php?f=20&t=67585&p=300917#p300917
Read the link about how to use parameters and the warning about several things.

I did also search for filepicker
viewtopic.php?f=20&t=65804&p=292293&hil ... er#p292293

Romke
LibreOffice 24.8.5.2 on openSUSE Leap 15.6
User avatar
Steve R.
Posts: 163
Joined: Mon Sep 21, 2009 12:06 am
Location: Morehead City, North Carolina

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by Steve R. »

Terrific, thanks for the links. A couple of days ago, while searching for filepicker, I found pickfolder and I have it partially integrated into the database. This then lead to the theme of this post for recursively obtaining all the filenames and filesizes under the directory.

Code: Select all

Public Sub PickFolder
    rem http://www.openoffice.org/api/docs/common/ref/com/sun/star/ui/dialogs/module-ix.html
    Dim FolderPicker As Object    
    rem Dim strDisplayDirectoryPath as String       
    FolderPicker=createUnoService("com.sun.star.ui.dialogs.FolderPicker")
    FolderPicker.execute    
    strDisplayDirectoryPath=FolderPicker.Directory
    strDisplayDirectoryPath=ConvertFromURL(strDisplayDirectoryPath)
    Forms("MainForm").Controls("TextBox1").value = strDisplayDirectoryPath	
End Sub
(note: The code above incorporates the extensions from Access2Base)
Ubuntu 16.04 and Windows 10
rudolfo
Volunteer
Posts: 1488
Joined: Wed Mar 19, 2008 11:34 am
Location: Germany

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by rudolfo »

As far as I can see the implementation in Basic with the dir function will have the limitation that it does not operate recursively. So you will have to manually program the recursion for yourself in Basic which is surely a pain ... and not only because Basic doesn't know anything about symlinks, fifos, devices and all those kind of objects that follow the "everything is a file in UNIX" philosophy.

So here are the promised 9 lines of codes that you need in order to implement the "find, xargs, stat" connected by a pipe in the shell program:

Code: Select all

#!/usr/bin/python

import sys
import os
import os.path

startDir = '.'
if len(sys.argv) > 1 and sys.argv[1]:
    startDir = sys.argv[1]

for root, dirs, files in os.walk(startDir):
    for name in files:
        fileAttributes = os.stat(os.path.join(root, name))
        print "{0:60s} {1:8d} {2}".format(os.path.join(root, name), fileAttributes.st_size, fileAttributes.st_mtime)
The output will look like:

Code: Select all

.\odfAnalyser.py                                                12313 1355871788.0
.\xpiReader.py                                                   2067 1344112386.0
.\sqlite-test.py                                                  410 1389835670.0
.\http-json.py                                                    665 1389833618.0
.\recurseDirectories.py                                           481 1392247690.0
.\recurseDirectories.py~                                          292 1392246596.0
.\CVS\Entries                                                      97 1366074372.0
.\CVS\Repository                                                   13 1366074370.0
.\CVS\Root                                                         41 1366074370.0
.\python-3\check-sys.py                                          1080 1326056310.0
.\python-3\fileLocking.py                                        1084 1357689070.0
.\python-3\http-get.py                                            223 1324606936.0
The first colum have the filenames padded with spaces to have an alignment of 60 characters. If you have several levels of subdirectories you might surely want to increase the 60 in {0:60s} to something higher like 80 or 120 characters. Or alternatively place the filenames which can differ very much in length at the end of the line (after the size and the timestamp).
The timestamp is in elapsed seconds since the start of the UNIX epoch. To have a nicer human readable output you can wrap this value into time.localtime(fileAttributes.st_mtime).
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
User avatar
Steve R.
Posts: 163
Joined: Mon Sep 21, 2009 12:06 am
Location: Morehead City, North Carolina

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by Steve R. »

Thanks very much. I see that the first line in the code is "#!/usr/bin/python". That resolves a question I had on how to implement Python. That will make experimenting easier. I have never used Python. Thanks again.
Ubuntu 16.04 and Windows 10
RPG
Volunteer
Posts: 2261
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by RPG »

Hello

I agree with Rudolfo that BASIC is not powerful. Special not for the file commands. I did not have seen that the search was recursive. I do not believe this code is better but I want only find an easy solution just for the fun.

I did remember the SimpleFileAccess service and did look to it for what is possible.

Code: Select all

REM  *****  BASIC  *****
dim SimpleFile ' This is the service variaabele

Sub Searchrecursive
	' This need a map name for doing the search
	dim start
	dim result()
	start="/home/romgro/Documenten/werk/move/movepdf"
	SimpleFile=CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
	DoSearch(ConvertToURL(start)) ' Call the sub what is doing the 
End Sub


sub DoSearch(sMapName)
dim result() 
print "Mapnaam: " & sMapName ' Show what we are doing
result() = SimpleFile.getFolderContents(sMapName,true)
for each sName in  result()
select case SimpleFile.getContentType(sName)
	case "application/vnd.sun.staroffice.fsys-folder"
		call DoSearch(sName) ' We have a mapname so do call again
	case "application/vnd.sun.staroffice.fsys-file"
		' We are a file now act what you want do
		print "FileName: " & sName ' Show what we are doing
	case else 
	print SimpleFile.getContentType(sName)  ' We see this only when there is a file we have not implement
end select
next
end sub
LibreOffice 24.8.5.2 on openSUSE Leap 15.6
User avatar
Steve R.
Posts: 163
Joined: Mon Sep 21, 2009 12:06 am
Location: Morehead City, North Carolina

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by Steve R. »

Once again thanks for the sample code and suggestions. I will be looking further into them. I ran into a couple of oops, in assembling the individual models for testing into a "main" model. The one which I fixed was how to pass the selection from the pickfolder application to the Bourne Shell application. The variable strDisplaySource is set by the pickfolder.

Code: Select all

Public Sub GeneratePlayList	
	Dim odbDatabase As Object    
	Set odbDatabase = Application.CurrentDb()	
	docmd.runCommand("DBRefreshTables") 		
	rem ------------------------------------------------------------------------
	rem generate external source table that the data base will link to.
	rem print strDisplaySource
	shell "/home/steve/MP3_Copy_Project/Generate_MP3_List.sh " + strDisplaySource 
       rem -------------------------------------------------------------------------	
    If TableExists("Table1") Then
                Print "Table Exists"
                rem Nothing Needs to be done since the table exists       	
               docmd.runSQL("SET TABLE ""Table1"" SOURCE ""music.txt"";")                 
         Else
               Print "Table Does NOT exist."
               rem Create Table if it does not exist.                                            
               docmd.runSQL("Create Text Table ""Table1"" (music VARCHAR(254));")            
               docmd.runSQL("SET TABLE ""Table1"" SOURCE ""music.txt"";") 	
    	End If    
    rem -------------------------------------------------  	
 	docmd.runCommand("DBRefreshTables") 	
End Sub
Revised Shell Script. The value of the variable strDisplaySource is passed to ${1}

Code: Select all

#!/bin/bash
# http://www.commandlinefu.com/commands/using/xargs/25
#find /media/My_Passport/Music -type f -name '*.mp3' -print0 | xargs -0 stat -c'%12s %n' > /home/steve/MP3_Copy_Project/music.txt
find ${1} -type f -name '*.mp3' -print0 | xargs -0 stat -c'%12s %n' > /home/steve/MP3_Copy_Project/music.txt
Now that the pickfolder application is working, it has exposed the problem that the internal Base table "Table1" (if it exists) is not refreshed based on updating the external source file "music.txt". If I delete "Table1" the new version is updated to reflect the new external source "music.txt". The problem is that Base does seem to initially recognize that "Table1" has been deleted, so it seems that docmd.runCommand("DBRefreshTables") is not working. Anyway, I will do more research on this. If I can't figure that out, I will create a new post. As it is, I still have to review your suggested code and my original question has been solved.

PS: Page 45 of theLibreOffice 4.0 documentation seems to imply that the either a manual refresh has to be done or the database closed and reopened. So it would appear that I am out-of-luck.
Ubuntu 16.04 and Windows 10
RPG
Volunteer
Posts: 2261
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by RPG »

Hello

I do not complete understand what you want. When you want work with a textfile in several maps then it is maybe good to test if that can work. I have the idea that the HSQLDB can only work with one directory map and that is the directory map where the HSQLDB is.
HSQLDB manual 1.81 wrote:File locations are restricted to below the directory that contains the database, unless the textdb.allow_full_path property is set true in the database properties file.
Romke
LibreOffice 24.8.5.2 on openSUSE Leap 15.6
User avatar
Steve R.
Posts: 163
Joined: Mon Sep 21, 2009 12:06 am
Location: Morehead City, North Carolina

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by Steve R. »

RPG wrote:I do not complete understand what you want. When you want work with a textfile in several maps then it is maybe good to test if that can work. I have the idea that the HSQLDB can only work with one directory map and that is the directory map where the HSQLDB is.
HSQLDB manual 1.81 wrote:File locations are restricted to below the directory that contains the database, unless the textdb.allow_full_path property is set true in the database properties file.
Romke
Sucess!!!! My Base table can now be automatically "updated" to match the source textfile. No need to somehow refresh the tables.

Now for the long long long explanation. Adding "Source Off" and reconnecting Table1 to the source textfile achieved the objective of "updating" the Base file. See the code below.
Also, the source textfile can be in the same directory that Base is launched from. I ran that as an experiment also.

While is seems obvious now in retrospect, it did not dawn on me that turning off the source and reconnecting the table was the solution.

Code: Select all

If TableExists("Table1") Then
               docmd.runSQL ("SET TABLE ""Table1"" SOURCE OFF;")       	
               docmd.runSQL("SET TABLE ""Table1"" SOURCE ""music.txt"";")                                 
         Else
               docmd.runSQL("Create Text Table ""Table1"" (music VARCHAR(254));")            
               docmd.runSQL("SET TABLE ""Table1"" SOURCE ""music.txt"";") 	
       End If 
Note: The solution above requires that Access2Base extension be installed.
Infromation Source: http://www.hsqldb.org/doc/guide/ch06.html
See Chapter 6. Text Tables - version 1.8 : Text Tables as a Standard Feature of Hsqldb
rem Requires Access2base Extension
Ubuntu 16.04 and Windows 10
User avatar
Steve R.
Posts: 163
Joined: Mon Sep 21, 2009 12:06 am
Location: Morehead City, North Carolina

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by Steve R. »

New improved solution below. :D
RPG wrote:I agree with Rudolfo that BASIC is not powerful. Special not for the file commands. I did not have seen that the search was recursive. I do not believe this code is better but I want only find an easy solution just for the fun.
I did remember the SimpleFileAccess service and did look to it for what is possible.

Code: Select all

REM  *****  BASIC  *****
dim SimpleFile ' This is the service variaabele

Sub Searchrecursive
	' This need a map name for doing the search
	dim start
	dim result()
	start="/home/romgro/Documenten/werk/move/movepdf"
	SimpleFile=CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
	DoSearch(ConvertToURL(start)) ' Call the sub what is doing the 
End Sub


sub DoSearch(sMapName)
dim result() 
print "Mapnaam: " & sMapName ' Show what we are doing
result() = SimpleFile.getFolderContents(sMapName,true)
for each sName in  result()
select case SimpleFile.getContentType(sName)
	case "application/vnd.sun.staroffice.fsys-folder"
		call DoSearch(sName) ' We have a mapname so do call again
	case "application/vnd.sun.staroffice.fsys-file"
		' We are a file now act what you want do
		print "FileName: " & sName ' Show what we are doing
	case else 
	print SimpleFile.getContentType(sName)  ' We see this only when there is a file we have not implement
end select
next
end sub
Thanks very much. You helped me skip a step. I was delaying developing the code for the direct import of data till later due my lack of knowledge.
The sample code you provided allowed me to figure out how to directly import file data into Base.
The adapted code is shown below.
Essentially, your code above is equivalent to the use of the "File System Object" in MS Access (My Post of Feb 12, 2014 11:35 am) and it appears that UNO Service "SimpleFileAccess" is equivalent.
I am still at a loss on concerning what UNO services are available and how to use them. As this project progresses, I should eventually figure it out.

rudolfo: Thanks for the Python sample code. It worked. However, I don't know Python, so further use of Python will have to wait till I pick-up some experience. As it is transitioning to Base from MS Access has been a major learning experience.

Code: Select all

REM  *****  BASIC  *****
   
dim SimpleFile ' This is the service variable
Dim oRecordset As Object 
	
Sub SearchRecursive
	rem Requires a map name for doing the search
	dim start
	dim result()
	docmd.runsql("Delete From ""Table2"";")	'Deletes prior testing data so that you can examine new additions. 
   Set oRecordset = Application.CurrentDb().OpenRecordset("Table2")	
	start="/media/My_Passport/Music"
	SimpleFile=CreateUnoService("com.sun.star.ucb.SimpleFileAccess")	
	DoSearch(start) 'Call the sub that is doing the recurive search
	oRecordset.mClose 
End Sub

sub DoSearch(sMapName)
    dim result()      
    rem print "MapName: " & sMapName ' Show what we are doing
    result() = SimpleFile.getFolderContents(sMapName,true)
    for each sName in  result()
    select case SimpleFile.getContentType(sName)
       case "application/vnd.sun.staroffice.fsys-folder"
          call DoSearch(sName) ' We have a mapname so do call again
       case "application/vnd.sun.staroffice.fsys-file"
          rem We are a file now - Enter code for what you want done
          rem print "FileName: " & ConvertFromURL(sName) ' Show what we are doing         
          if Right(sName,4)=".mp3" then         
          	With oRecordset 'Adds FileName directly into Base	          
          	 	.AddNew
          			.Fields("MusicText").Value =  ConvertFromURL([sName])  
          			.Fields("MFileSize").Value =  SimpleFile.getSize([sName])         		
          	 	.Update
          	End With
          end if            		
       case else
       		print SimpleFile.getContentType(sName)  ' We see this only when there is a file we have not implement
    	end select
    next    
 end sub 
Ubuntu 16.04 and Windows 10
RPG
Volunteer
Posts: 2261
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by RPG »

Hello

When you want work with OOo and want make some code then you need:
a) Understanding of Open Office.org
b) Programming skills

For most people who do ask here question real often they lack both and want do things they cannot and they think it can be doen with a single command.

You ask this in the forum for base so I point the answer to that and to make code. When you want make code for a Base form then most of the time you have three parts
a) UNO
b) SQL
c) one programing language

Those three parts do have no knowledge of each other. Only Uno and the programming language can change easy data.

For a data base the SQL part is the most important part. So a good understanding of SQL is important. The programming language is not so important and I think for easy things BASIC is good. When you want do complex things then BASIC is the wrong took but maybe OOo is the wrong tool.

Now Uno when you start in OOo you start not clean but most of the time from a spreadsheet or an other part in which you want adjust that document. That document you have export several service. Also it does have properties, methodes and interfaces. Understanding this idea is real important. You have to find or create the services you need.

In your case you have to create the service and the servive export the interface you need. The interfaces does have methods and maybe properties.

I will end with the idea that it is better to use only uno call and no pseudo MS Access commands.

For passing the data to the database use preparestatement.
search.php?keywords=preparestatement&te ... mit=Search
Use the search link. It point to posts of Rudolfo. I did learn from him to use the preparestatement for reason of security.

Romke
LibreOffice 24.8.5.2 on openSUSE Leap 15.6
User avatar
Steve R.
Posts: 163
Joined: Mon Sep 21, 2009 12:06 am
Location: Morehead City, North Carolina

Re: [Solved] Using Shell in Base to Execute Linux Commands.

Post by Steve R. »

Thanks for all your help at getting me started. Still a lot to learn.
Ubuntu 16.04 and Windows 10
User avatar
Steve R.
Posts: 163
Joined: Mon Sep 21, 2009 12:06 am
Location: Morehead City, North Carolina

Re: Using Shell in Base to Execute Linux Commands.

Post by Steve R. »

rudolfo wrote:Alternatively you can use Python and either os.path.walk or os.walk which is the Python way to recurse through directories. Might be not a one line script as with find, but it shouldn't be more then 10 lines.
Thank-you for suggesting Python. I am spending my morning in getting an introduction to Python as an option for my project as I keep pecking away at it.

BASIC to Python
A Very Quick Comparison of Popular Languages for Teaching Computer Programming

PS: Our regional library system does not have a book on Python. For whatever reason, libraries these days do not seem posses current computer related books.
Ubuntu 16.04 and Windows 10
Post Reply