Db files and path script

Remove existant files from destination by single file
    
  select 'rm -rf ' || file_name from (
    select file_name from dba_data_files
    union all
    select file_name from DBA_TEMP_FILES
    union all
    select member file_name from v$logfile
    union all
    select name from v$controlfile
  )

Remove existant files from destination by path

select 'rm -rf ' || path || '/*' from (
  select distinct substr(file_name, 1, instr(file_name, '/', -1) -1) path from (
    select file_name from dba_data_files
    union all
    select file_name from DBA_TEMP_FILES
    union all
    select member file_name from v$logfile
    union all
    select name from v$controlfile
  )
) 

 

Create db paths on a new host
#Run on source
#!replace bold parts!
    
select 'mkdir ' || replace(path, 'PRO', 'INT') from (
  select distinct substr(file_name, 1, instr(file_name, '/', -1) -1) path from (
    select file_name from dba_data_files
    union all
    select file_name from DBA_TEMP_FILES
    union all
    select member file_name from v$logfile
    union all
    select name from v$controlfile
  )
)