[SOLVED]Copying multiple files from multiple directories to one folder
Title says it all. I have a discography folder with subfolders of the different years and albums of a band each containing music, some also have more sub folders. What I want to do is copy all of the music (.mp3's) from all the folders and sub folders into just one music folder. I found a find and -exec cp command before but it did absolutely nothing for whatever reason. Perhaps I did it wrong. Can anyone help me?
Thanks
Last edited by SiegeMachine (2009-11-15 06:54:40)
. refers to the directory to search (the current directory), it's not a pattern - here's what you want:
find . -iname '*.mp3' -type f -exec cp {} target_dir/ \;
This is assuming you're in the music directory - if not, you want
find /path/to/music -iname '*.mp3' -type f -exec cp {} target_dir/ \;
Last edited by Pox (2009-11-15 06:53:59)
Similar Messages
-
How ATTACH multiple files from different folders in one ATTACH 'session'?
Hi,
In Mac Mail, I often have to attach 2 or 3 separate files, all from different folder locations on my hard drive.
This requires clicking attach, selecting file 1 and clicking OK, which closes the Attach dialog.
Then I have to do it again 2 times for each other file. oy.
Is there a way to Highlight multiple files in different directories (ala Command-Select...which doesn't work) before selecting OK?
OR
I've found that I can DRAG a file from the Attach dialog into the email and the dialog will remain open, only the file is HIGHLIGHTED in the email and , hence, gets replaced by the next file I drag into the email (or select by the normal method)....
Is there a way to drag that file#1 into the email and have it NOT remain highlighted, so that I can pick another file to add in addition to that one?
Thanks!ShizzleFizzle wrote:
Is there a way to Highlight multiple files in different directories (ala Command-Select...which doesn't work) before selecting OK?
Have you tried dragging files from Finder windows into the mail message window? -
Loading multiple files from multiple users.
Our system is moving from a standalone app to a web system. The users will have export files generated by our app which they will need to import up to the web. In the web system, the users are connecting via SSO, so apps server is using a single JDBC connection and we are querying the CLIENT_IDENTIFIER at the database end to see who is doing what.
The export file is essentially a zip with the first file being a list of which filenames in the zip translate to what tables in the database they are from.
The new system will require a little work on each file to update certain things prior to actually inserting the data to its final destination.
My confusion is how to best do this. What we essentially need to do is move the data from the text file into a table along with some flag for identifying the user that put it there. Then update the data as needed and finally insert it to the final table destination. The first thought was to use external tables. However if you have two users importing at the same time, how do you differentiate the data? The other idea was to use sqlldr. The trouble was there is no way (that I'm aware of) to be able to add the flag for who's data this is on the way over with sqlldr, it will only bulk copy the data from the file over to the table you specify.
So the basic question is how do I get data for a single table into the system when I have multiple users (SSO signed on using the same DB connection via apps) uploading their own copies of data ultimately headed for the same database table but the data needs a little modification on the way? What's the best way to do this?
Thanks.Our system is moving from a standalone app to a web system. The users will have export files generated by our app which they will need to import up to the web. In the web system, the users are connecting via SSO, so apps server is using a single JDBC connection and we are querying the CLIENT_IDENTIFIER at the database end to see who is doing what.
The export file is essentially a zip with the first file being a list of which filenames in the zip translate to what tables in the database they are from.
The new system will require a little work on each file to update certain things prior to actually inserting the data to its final destination.
My confusion is how to best do this. What we essentially need to do is move the data from the text file into a table along with some flag for identifying the user that put it there. Then update the data as needed and finally insert it to the final table destination. The first thought was to use external tables. However if you have two users importing at the same time, how do you differentiate the data? The other idea was to use sqlldr. The trouble was there is no way (that I'm aware of) to be able to add the flag for who's data this is on the way over with sqlldr, it will only bulk copy the data from the file over to the table you specify.
So the basic question is how do I get data for a single table into the system when I have multiple users (SSO signed on using the same DB connection via apps) uploading their own copies of data ultimately headed for the same database table but the data needs a little modification on the way? What's the best way to do this?
Thanks. -
Delete multiple files from multiple locations using config file
Hello All,
I am fairly new to .net and I have to make a windows application to delete files older than 90 days from multi ple locations. these multiple locations cant be hard coded and have to be configurable, also the number of days to delete the files have to be
configurable.
I think the answer to this would be an app.config file. but dont know how to use the same.
can anyone tell me about this and if possible help me out with a code snippet.?Add settings like picture below. Add the string by press the double dot icon.
The use the code below
static void Main(string[] args)
int deleteDays = Properties.Settings.Default.DeleteDays;
StringCollection folders = Properties.Settings.Default.Folders;
foreach (string folder in folders)
DirectoryInfo info = new DirectoryInfo(folder);
FileSystemInfo[] deleleteFiles = info.EnumerateFiles()
.Where(x => x.LastWriteTime < DateTime.Today.AddDays(deleteDays))
.ToArray() ;
foreach(FileSystemInfo file in deleleteFiles)
File.Delete(file.FullName);
jdweng -
Copying a file from iPhoto to an external folder
Hi,
I am having trouble getting the following to work. The first statement works and returns the path to the selected file. The second Finder command fails with the error message shown.
tell application "iPhoto"
set thisFile to (image path of theCurrentPhoto)
end tell
tell application "Finder"
duplicate file thisFile to folder desktopPath
end tell
The error message reads:
Result:
error "File /Users/Andy/Pictures/iPhoto Library/Originals/2004/2 Jun 2004/2004_0602Image0008.JPG wasn’t found." number -43 from "/Users/Andy/Pictures/iPhoto Library/Originals/2004/2 Jun 2004/2004_0602Image0008.JPG"
The file does exist as I can manually navigate to the folder and see the file. Although I have to tell Finder to 'View package contents". The variable 'desktopPath' was defined earlier in the script as:
set desktopPath to (path to desktop from user domain) as string
Could someone tell me why the Finder command to duplicate the file fails?
Thanks for your help.
AndyHi Andy,
iPhoto seems to be returing image path as "/Users/Andy/Pictures/iPhoto Library/Originals/2004/2 Jun 2004/2004_0602Image0008.JPG" which is a slash delim string.
Finder prefers good old macos colons so try this
"set thisFile to (image path of theCurrentPhoto) as POSIX file"
and see how it works. -
Send multiple files in different directories using Receiver File Adapter
Hi Experts,
I have one File to File without ESR scenario where I have to pick multiple files from different directories and to save them in different directories on receiver side.
Can anyne help me to send multiple files in different directories using receiver file adapter.
Is it possible??
Any help will be appreciated.
Regards,
Danishhi ,
that is possiable without esr,
we need to create one sender communication channel , in that we nend to use "adavnced selection for source file " for sending multiple files from multiple directories.
we need to create 'n' receiver communication channels and 'n' receiver agreements based on communication channels .
in receiver determination, provide multiple receivers
In interface determination , provide * symbol for receiver communication components
thanks, -
Picking files from multiple folders based on name send to destination folde
Hi,
I want to pick multiple files from multiple folders with one root folder. Based on file name I want to send it to diffirent folders. No need to go for message mapping. Can anyone suggest me.
Thanks & Regards,
Prasad Kotla.Hi Prasad,
to pick the files from multiple source directory, can use "Advance Selection for Source File" in Sender CC.
If you wand to develop a Scenario without Message mapping, develop a scenario as "Sender as Virtual receiver"
This option is available in Sender agreement, just give the dummy name for Msg Interface and Namespace, Name defined should be same in Rec Agreement.
Develop only: Sende CC, Receiver CC, SA, RA
No need to develop ID and RD as no mapping is involved.
If u want to send the files to different folders of receiver side, just develop the adapter module which changes the directory based on the sender filename.
If the sender and receiver directory is same than check the "adapter specific Msg Attribute" and "directory" checkbox in both the sender and receiver CC. in this case no need to develop Custom module for changing the directory. files will be automatically placed in the path they were picked from sendor directory
appreciate if useful
regards,
chandra shekhar -
FILES FROM MULTIPLE DIRECTORIES
Hi Experts,
I got a doubt here plz clarify it
1.How can we pick files from multiple directories ? and all the files will have different names?
Plz clarify this, good explanations willbe rewarded .
Regards,
Vinod.Hi Vinod Reddy,
One way that i know to solve this prob is by using the 'File Name Masking'.
This can be done with the sender channel, where you have to specify the
source directory as <NOTHING>
source file as <NOTHING>
This gives you an advanced selection option, where you need to give the Source Directories along with the File name masks (the source files).
Hope this may solve your problem.
regards
vinod v
reward me if its helpful. -
How to pickup files from multiple directories
Hi all,
How to pickup files from multiple directories and send it to two different folders at target
Ex:
files\xi\us\US.txt
files\xi\uk\UK.txt
i need to pick up the above mentioned two files and send it to the following paths
app1\files\us\download\US.txt
app1\files\uk\download\UK.txt
US.txt has to goto US folder and UK.txt has to goto UK folder only
RegardsHi,
To pick form multiple folders, select Advanced Mode for file selection in file adapter..
there u can specify directory name/file names
Refer
/people/mickael.huchet/blog/2006/09/18/xipi-how-to-exclude-files-in-a-sender-file-adapter
To put those files at multiple folders write a command line arguments for this.. go through this weblog...
/people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
XI/PI: Command line sample functions
/people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
Hope this will help you....
Regds,
Pinangshuk. -
Retrive files from multiple source directories
Hi,
I need to retrive diffirent formet files from multiple directories and based on file name I need to send it to destination folders. Can anybody suggest me How can I impliment this interface.
Thanks & Regards
VenkatKVenkat,
I hope since you are taking different format files, you are not doing any mapping. You are moving from one location to another location, because if you different formats then you can do in one mapping your requirement.
If it is correct then as shabharish mentioned you can pick the files using multiple file sender adapters. With this you can pick the files, but to send to different directories enable ASMA in sender file commkunication channel. Then in receiver communication check the extension for each format and then give the directory name so that it routes to the destination you mentioned.
Regards,
---Satish -
Can't copy multiple files from compact flash via USB3
Problems on MacBook Pro Retina 15-inch with Mavericks installed...
I am not able to copy multiple files from an attached Lexar USB3 Compact Flash reader (card is 128GB Lexar UDMA 7 compliant). Files are video files and when I try to copy more than one at a time the screen of my MacBook Pro flashes "off" and back "on" and the copy process ceases...
Any fixes for this???See: https://discussions.apple.com/thread/5471050?tstart=60
Update the firmware of your USB 3.0 card reader. It's weird to think there is firmware on the thing, but it worked for me! -
Picking up files from multiple directories
Hi All
We have scenario where each sore has its one folder with all the files in the folder, now there is about 200 stores so and about 30 interfaces that picks up files from those directories. It's gonna take some time to add al the directories to all 30 interfaces. Is there an easier way to do this?
Regards>
stephan claassen wrote:
> Hi
>
> Thx for reply
>
> abhishek salvi what do mean by ServerName/*? we only have the IP.
> If I put in /SAPXI/METSAPXI/* it sais: A file or directory in the path name does not exist
>
> Regards
Suppose you have one File Server installed (say SAP).....it has only two sub-folders (say XI and PI)....now you want to pick files from both the sub-folders....so you can try SAP/* ........
Please open your File Server location and any sub-folder within it and check if it is / or \ .....and then use the slash (/ or \) accordingly ......if you have IP and no name then give the IP.....rest logic remains the same....
Regards,
Abhishek. -
How to store multiple files from SAp in to Application server?
Hi Guys,
Can anybody tell me how to store multiple files from SAP into Application server.in my application i have to get the data from SAP tables BSEG , BKPF , BSAK and BSIK that to daily i have to do.
Any Logic or Code for how to do is welcomed.
plz help me urgently.
Thanks,
GopiHi,
directories creates basis. If you have task to store data in application server you already should have information into which folder you have to do it. If you don't have this information because it is just for example training for next task then you can use your personal folder into which you have access. To get list of all available folders please look at attached code and form get_directories (you get the list of folders you see in transaction AL11). But don't forget: If you are using open dataset you have to have rights to access application folder!
Here you are code which I use to upload text files from local disc into application folder
Regards,
Karol
*& Report FILE_PC_TO_SAP
REPORT FILE_PC_TO_SAP.
DATA: BEGIN OF searchpoints OCCURS 100,
DIRNAME(200) TYPE c, " name of directory.
sp_name(100) TYPE c," name of entry. (may end with *)
END OF searchpoints.
DATA: BEGIN OF isearchpoints OCCURS 10,
dirname(75) TYPE c, " name of directory.
aliass(75) TYPE c, " alias for directory.
svrname(75) TYPE c, " svr where directory is availabl
sp_name(75) TYPE c, " name of entry. (may end with *)
sp_cs(10) TYPE c, " ContainsString pattern for name
END OF isearchpoints.
data: l_file type filetable.
data: l_rc type i.
data: itab type TABLE OF string.
data: g_tmp_file_path type rlgrap-filename.
data: wa_itab type string.
data: h_destin(100) type c.
data: dat type string.
INITIALIZATION.
perform get_directories.
START-OF-SELECTION.
parameters: in_file type string OBLIGATORY LOWER CASE.
parameters: destin(100) type c OBLIGATORY LOWER CASE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = in_file
"FILETYPE = 'BIN'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
TABLES
DATA_TAB = itab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.
IF sy-SUBRC <> 0.
write: / 'Error during loading input file!'.
ENDIF.
if h_destin is INITIAL.
h_destin = in_file.
endif.
CONCATENATE destin h_destin into dat SEPARATED BY '/'.
*TRANSLATE dat TO UPPER CASE.
OPEN DATASET dat FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-SUBRC = 0.
loop at itab into wa_itab.
TRANSFER: wa_itab TO dat.
endloop.
CLOSE DATASET dat.
write: / 'File uploaded!'.
ELSE.
write: / 'Not possible to open dataset'.
ENDIF.
at selection-screen on value-request for in_file.
perform select_input_file_name.
loop at l_file into g_tmp_file_path.
move g_tmp_file_path to in_file.
h_destin = ''.
SPLIT g_tmp_file_path at '\' into table itab.
loop at itab into g_tmp_file_path.
h_destin = g_tmp_file_path.
endloop.
endloop.
at selection-screen on value-request for destin.
DATA: lt_dfies TYPE TABLE OF dfies.
DATA: lwa_dfies TYPE dfies.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = '/BI0/PCO_AREA'
lfieldname = 'CO_AREA'
IMPORTING
dfies_wa = lwa_dfies.
lwa_dfies-tabname = 'searchpoints'.
lwa_dfies-REPTEXT = 'Destination directory'.
lwa_dfies-LENG = 100.
lwa_dfies-INTLEN = 100.
lwa_dfies-OUTPUTLEN = 100.
lwa_dfies-fieldname = 'SP_NAME'.
APPEND lwa_dfies TO lt_dfies.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'SP_NAME'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'destin'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = searchpoints
FIELD_TAB = lt_dfies
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
*& Form select_input_file_name
* text
form select_input_file_name.
* call function 'F4_FILENAME'
* exporting
* program_name = sy-repid
* dynpro_number = sy-dynnr
* field_name = 'PATH'
* importing
* file_name = g_tmp_file_path.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Please choose a file'
"default_extension = '*.TXT'
"default_filename = 'C:\*.txt'
initial_directory = 'C:\'
file_filter = '*.*'
CHANGING
FILE_TABLE = l_file
RC = l_RC
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. "select_input_file_name
*& Form WRITE_DB_HOME
* Write DB home directory
* no parameters
FORM write_db_home.
CASE sy-dbsys(3).
WHEN 'ORA'.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_ORAHOME'
ID 'VALUE' FIELD searchpoints-dirname.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_ORAHOME', 30 searchpoints-dirname.
MOVE: 'DIR_ORAHOME' TO searchpoints-sp_name.
APPEND searchpoints.
*--- C5056155 End of ALV -------------------------------*
WHEN 'ADA'.
CALL 'C_GETENV' ID 'NAME' FIELD 'DBROOT'
ID 'VALUE' FIELD searchpoints-dirname.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_ADA_DBROOT', 30 searchpoints-dirname.
MOVE: 'DIR_ADA_DBROOT' TO searchpoints-sp_name.
APPEND searchpoints.
*--- C5056155 End of ALV -------------------------------*
WHEN 'INF'.
CALL 'C_GETENV' ID 'NAME' FIELD 'INFORMIXDIR'
ID 'VALUE' FIELD searchpoints-dirname.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_INF_INFORMIXDIR', 30 searchpoints-dirname.
MOVE: 'DIR_INF_INFORMIXDIR' TO searchpoints-sp_name.
APPEND searchpoints..
*--- C5056155 End of ALV -------------------------------*
WHEN 'DB6'.
CALL 'C_GETENV' ID 'NAME' FIELD 'INSTHOME'
ID 'VALUE' FIELD searchpoints-dirname.
IF sy-subrc = 0.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_DB2_HOME', 30 searchpoints-dirname.
MOVE: 'DIR_DB2_HOME' TO searchpoints-sp_name.
APPEND searchpoints.
*--- C5056155 End of ALV -------------------------------*
ELSE.
EXIT.
ENDIF.
WHEN OTHERS.
EXIT.
ENDCASE.
ENDFORM. " WRITE_DB_HOME
FORM get_directories.
* get the name and aliases of ALL userdefined directories
SELECT * FROM user_dir INTO isearchpoints
WHERE svrname = sy-uname.
MOVE isearchpoints-dirname to searchpoints-dirname.
MOVE isearchpoints-aliass to searchpoints-sp_name.
APPEND searchpoints.
ENDSELECT.
SELECT * FROM user_dir INTO isearchpoints
WHERE svrname = 'all'.
MOVE isearchpoints-dirname to searchpoints-dirname.
MOVE isearchpoints-aliass to searchpoints-sp_name.
APPEND searchpoints.
ENDSELECT.
* Get DB home
IF sy-dbsys(3) = 'ADA'.
PERFORM write_db_home.
ENDIF.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_ATRA'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_ATRA' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_BINARY'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_BINARY' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory $DIR_CCMS
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_CCMS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_CCMS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_CT_LOGGING'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_CT_LOGGING' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_CT_RUN'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_CT_RUN' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_DATA'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_DATA' TO searchpoints-sp_name.
APPEND searchpoints.
* Get DB home
IF sy-dbsys(3) = 'DB6'.
PERFORM write_db_home.
ENDIF.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_DBMS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_DBMS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_EXECUTABLE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_EXECUTABLE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_EXE_ROOT'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_EXE_ROOT' TO searchpoints-sp_name.
APPEND searchpoints.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GEN'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GEN' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GEN_ROOT'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GEN_ROOT' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GLOBAL'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GLOBAL' TO searchpoints-sp_name.
APPEND searchpoints.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GRAPH_EXE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GRAPH_EXE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GRAPH_LIB'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GRAPH_LIB' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_HOME'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_HOME' TO searchpoints-sp_name.
APPEND searchpoints.
* Get DB home
IF sy-dbsys(3) = 'INF'.
PERFORM write_db_home.
ENDIF.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_INSTALL'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_INSTALL' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_INSTANCE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_INSTANCE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_LIBRARY'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_LIBRARY' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_LOGGING'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_LOGGING' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the files written by the memory inspector
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_MEMORY_INSPECTOR'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_MEMORY_INSPECTOR' TO searchpoints-sp_name.
APPEND searchpoints.
* Get DB home
IF sy-dbsys(3) = 'ORA'.
PERFORM write_db_home.
ENDIF.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PAGING'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PAGING' TO searchpoints-sp_name.
APPEND searchpoints.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PUT'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PUT' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PERF'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PERF' TO searchpoints-sp_name.
APPEND searchpoints.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PROFILE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PROFILE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PROTOKOLLS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PROTOKOLLS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_REORG'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_REORG' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_ROLL'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_ROLL' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_RSYN'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_RSYN' TO searchpoints-sp_name.
APPEND searchpoints.
* calculate directory for saphostagent (no sapparam available...)
IF ( sy-opsys(3) = 'WIN' ) OR ( sy-opsys(3) = 'Win' ).
DATA: windir_path(64), programfiles_path(64).
* hoping that ProgramFiles is set in service user environment
CALL 'C_GETENV' ID 'NAME' FIELD 'ProgramFiles'
ID 'VALUE' FIELD programfiles_path.
IF programfiles_path IS INITIAL.
* %ProgramFiles% not available. guess from windir
CALL 'C_GETENV' ID 'NAME' FIELD 'windir'
ID 'VALUE' FIELD windir_path.
* e.g. S:\WINDOWS ==> S:\Program Files
CONCATENATE windir_path(3) 'Program Files' INTO programfiles_path.
ENDIF.
CONCATENATE programfiles_path '\SAP\hostctrl'
INTO searchpoints-dirname.
ELSE.
* on UNIX, the path is hard coded
searchpoints-dirname = '/usr/sap/hostctrl'.
ENDIF.
MOVE: 'DIR_SAPHOSTAGENT' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SAPUSERS'
ID 'VALUE' FIELD searchpoints-dirname.
IF searchpoints-dirname = '.'.
IF sy-opsys = 'Windows NT'.
searchpoints-dirname = '.\'.
ELSE.
searchpoints-dirname = './'.
ENDIF.
ENDIF.
MOVE: 'DIR_SAPUSERS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SETUPS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_SETUPS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SORTTMP'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_SORTTMP' TO searchpoints-sp_name.
APPEND searchpoints.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SOURCE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_SOURCE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TEMP'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TEMP' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TRANS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TRANS' TO searchpoints-sp_name.
APPEND searchpoints.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TRFILES'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TRFILES' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TRSUB'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TRSUB' TO searchpoints-sp_name.
APPEND searchpoints.
* get the name of the current server.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'rdisp/myname'
ID 'VALUE' FIELD searchpoints-dirname.
data: h_ind type i.
LOOP AT searchpoints.
h_ind = sy-tabix.
IF searchpoints-sp_name IS INITIAL.
DELETE searchpoints INDEX h_ind.
ENDIF.
ENDLOOP.
ENDFORM. -
Fetching of multiple files from Application Server into SAP Program
Hi All,
I have a issue related <b>Fetching of multiple files from Application Server into SAP Program</b>.
Actual issue is as below.
In the <b>selection screen</b> of <b>my program</b> i will give <b>Application Server Path</b> as :
<b>/PW/DATA/SAP/D1S/PP/DOWN/eppi0720*</b>
Then the based on above input it should pick up all the files that are matching <b>eppi0720*</b> criteria.
Suppose if i am having <b>5</b> files with above scenario, i have to fetch all those <b>5</b> files at a time and place in my SAP Program.
All those 5 file's data should come into SAP at a time.
Can anybody tell me how can we solve above issue.
If any body has come across same issue please provide me with solution.
Thanks in advance.
Thanks & Regards,
Rayeez.If you want to get around the authorization check, you can do something like this.
report zrich_0001 .
parameters: p_path type epsf-epsdirnam
default '/usr/sap/TST/SYS/global'.
parameters: p_file type epsf-epsfilnam default 'CO*'.
start-of-selection.
perform get_file_list.
* FORM get_file_list *
form get_file_list.
types: name_of_dir(1024) type c,
name_of_file(260) type c,
name_of_path(1285) type c.
data: begin of file_list occurs 100,
dirname type name_of_dir, " name of directory. (possibly
" truncated.)
name type name_of_file, " name of entry. (possibly
" truncated.)
type(10) type c, " type of entry.
len(8) type p, " length in bytes.
owner(8) type c, " owner of the entry.
mtime(6) type p, " last modification date, seconds since 1970
mode(9) type c, " like "rwx-r-x--x": protection mode.
useable(1) type c,
subrc(4) type c,
errno(3) type c,
errmsg(40) type c,
mod_date type d,
mod_time(8) type c, " hh:mm:ss
seen(1) type c,
changed(1) type c,
end of file_list.
data: begin of file,
dirname type name_of_dir, " name of directory. (possibly
" truncated.)
name type name_of_file, " name of entry. (possibly
" truncated.)
type(10) type c, " type of entry.
len(8) type p, " length in bytes.
owner(8) type c, " owner of the entry.
mtime(6) type p, " last modification date, seconds since 1970
mode(9) type c, " like "rwx-r-x--x": protection mode.
useable(1) type c,
subrc(4) type c,
errno(3) type c,
errmsg(40) type c,
mod_date type d,
mod_time(8) type c, " hh:mm:ss
seen(1) type c,
changed(1) type c,
end of file.
call 'C_DIR_READ_FINISH' " just to be sure
id 'ERRNO' field file_list-errno
id 'ERRMSG' field file_list-errmsg.
call 'C_DIR_READ_START' id 'DIR' field p_path
id 'FILE' field p_file
id 'ERRNO' field file-errno
id 'ERRMSG' field file-errmsg.
if sy-subrc <> 0.
sy-subrc = 4.
exit.
endif.
* Read the file list and add to internal table.
do.
clear file.
call 'C_DIR_READ_NEXT'
id 'TYPE' field file-type
id 'NAME' field file-name
id 'LEN' field file-len
id 'OWNER' field file-owner
id 'MTIME' field file-mtime
id 'MODE' field file-mode
id 'ERRNO' field file-errno
id 'ERRMSG' field file-errmsg.
if sy-subrc = 1.
exit.
endif.
append file to file_list.
enddo.
* Write out the file list
loop at file_list.
write:/ file_list-name.
endloop.
endform.
Regards,
Rich Heilman -
How do I search for a word through multiple files in my directories ??
Hello everyone
How do I search for a word through multiple files in my directories ??
I am guessing one tedious way to do it would be to pass all the file names as command line arguments but I"m sure there exist a much easier and faster way to do it.
Thanks a lotYou need to pass only the directory name as parameter and then retrieve the files(recursively throug subdirs or not, however you wish) of that directory.
There were at least 2 threads yesterday on how to retrieve files from directory, and there are many others in the archive so I leave the search part to you ;)
HTH
Mike
Maybe you are looking for
-
Help needed: Adding 2nd widget makes 1st widget stop working
Dear all, I use 1 widget, jQuery Cycle, and it was working fine, until i added a 2nd one, FlexSlider. How can i make both working on the same page? My website is : VINDSTERS - Wij Vinden wat u zoekt! and please see my coding below. Thanks a lot! <!D
-
How to pass a refcursor to a java stored proc
Hi all, Please forgive me as I am new to Java and JDeveloper.... I want to pass a refcursor to a java stored proc. Does anyone know how to accomplish this? Thanks, dayneo
-
Container Managed Transactions II
I have a session bean method called insertComanda(). Its transaction attribute is "required". public void insertComanda (Table1VO vo1, Table2VO vo2) throws Exception daoTable1.insertTable1(); //Inserts data in table 1 daoTable2.insertTable2(); //Inse
-
UCCX - abandoned calls marked as handled contactinactiveexception
Hi I have a UCCX 8.5 script - at the start of the script it uses the IF contactinactiveexception exception occurs go to - which then goes to a label which clears the exception and then marks the call as handled What I have noticed is that this step i
-
Isolation Method in the Master Iview
Hi all I have noticed that the Isolation Method for the Master Iview is hardcoded to "URL". But I need the portal integration of reports to be embedded so the server is fetching the report instead of the client. If Isolation Method=URL then the clien