سؤال

i have a variable that holds the file name and the location of that file, i need to move that file from one location to another.How can it be done using informix 4gl

هل كانت مفيدة؟

المحلول

The RUN command will be used:

LET cmd = "mv ", old_location, "/", file_name, " ", new_location

RUN cmd

This assumes that old_location, file_name and new_location are all VARCHAR variables and not CHAR variables. If they are CHAR, you need to strip trailing blanks before concatenating:

LET cmd = "mv ", old_location CLIPPED, "/", file_name CLIPPED, " ", new_location CLIPPED

(You could omit the last CLIPPED.) This also assumes there are no spaces in the file names or locations. You have to work a bit harder if spaces can be present; you have to work considerably harder if you need to deal with quotes or newlines (etc) in the file names.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top