General file trading function